From 3ff5480d7ba0522919f1753b1bb4d570e9d26a46 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 19 Jul 2008 07:42:34 +0000 Subject: [PATCH] remove unnecessary "V = NULL;" stmts after VIR_FREE(V) * src/domain_conf.c (virDomainChrDefParseXML) (virDomainNetDefParseXML): Likewise. * src/iptables.c (iptRuleFree): Likewise. * src/storage_backend.c (virStorageBackendRunProgRegex): Likewise. * src/test.c (testOpenFromFile): Likewise. * src/xmlrpc.c (xmlRpcCallRaw): Likewise. --- ChangeLog | 12 +++++++++++- src/domain_conf.c | 5 +---- src/iptables.c | 2 -- src/storage_backend.c | 4 +--- src/test.c | 8 ++------ src/xmlrpc.c | 1 - 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0d29fd12d..b757a1032a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,14 @@ -Wed Jul 18 13:01:38 CEST 2008 Jim Meyering +Sat Jul 19 09:41:53 CEST 2008 Jim Meyering + + remove unnecessary "V = NULL;" stmts after VIR_FREE(V) + * src/domain_conf.c (virDomainChrDefParseXML) + (virDomainNetDefParseXML): Likewise. + * src/iptables.c (iptRuleFree): Likewise. + * src/storage_backend.c (virStorageBackendRunProgRegex): Likewise. + * src/test.c (testOpenFromFile): Likewise. + * src/xmlrpc.c (xmlRpcCallRaw): Likewise. + +Fri Jul 18 13:01:38 CEST 2008 Jim Meyering enable format-safety checks for virDomainReportError * src/domain_conf.c (virDomainReportError): Declare using diff --git a/src/domain_conf.c b/src/domain_conf.c index 2ff5d1a698..f139609193 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -700,7 +700,6 @@ virDomainNetDefParseXML(virConnectPtr conn, if (STRPREFIX((const char*)ifname, "vnet")) { /* An auto-generated target name, blank it out */ VIR_FREE(ifname); - ifname = NULL; } } else if ((script == NULL) && (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET) && @@ -958,10 +957,8 @@ virDomainChrDefParseXML(virConnectPtr conn, bindService = virXMLPropString(cur, "service"); } - if (def->type == VIR_DOMAIN_CHR_TYPE_UDP) { + if (def->type == VIR_DOMAIN_CHR_TYPE_UDP) VIR_FREE(mode); - mode = NULL; - } } } else if (xmlStrEqual(cur->name, BAD_CAST "protocol")) { if (protocol == NULL) diff --git a/src/iptables.c b/src/iptables.c index e7613e2bed..3e3a1a2261 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -266,14 +266,12 @@ static void iptRuleFree(iptRule *rule) { VIR_FREE(rule->rule); - rule->rule = NULL; if (rule->argv) { int i = 0; while (rule->argv[i]) VIR_FREE(rule->argv[i++]); VIR_FREE(rule->argv); - rule->argv = NULL; } } diff --git a/src/storage_backend.c b/src/storage_backend.c index 3e4e39cadd..a164a08e56 100644 --- a/src/storage_backend.c +++ b/src/storage_backend.c @@ -444,10 +444,8 @@ virStorageBackendRunProgRegex(virConnectPtr conn, goto cleanup; /* Release matches & restart to matching the first regex */ - for (j = 0 ; j < totgroups ; j++) { + for (j = 0 ; j < totgroups ; j++) VIR_FREE(groups[j]); - groups[j] = NULL; - } maxReg = 0; ngroup = 0; } diff --git a/src/test.c b/src/test.c index d0bb00350b..b7b9df0150 100644 --- a/src/test.c +++ b/src/test.c @@ -461,10 +461,8 @@ static int testOpenFromFile(virConnectPtr conn, dom->def->id = privconn->nextDomID++; dom->persistent = 1; } - if (domains != NULL) { + if (domains != NULL) VIR_FREE(domains); - domains = NULL; - } ret = virXPathNodeSet("/node/network", ctxt, &networks); if (ret < 0) { @@ -498,10 +496,8 @@ static int testOpenFromFile(virConnectPtr conn, net->persistent = 1; } - if (networks != NULL) { + if (networks != NULL) VIR_FREE(networks); - networks = NULL; - } xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); diff --git a/src/xmlrpc.c b/src/xmlrpc.c index d62760776a..cbca38931a 100644 --- a/src/xmlrpc.c +++ b/src/xmlrpc.c @@ -443,7 +443,6 @@ static char *xmlRpcCallRaw(const char *url, const char *request) if (ret != len) { errno = EINVAL; VIR_FREE(response); - response = NULL; xmlRpcError(VIR_ERR_POST_FAILED, _("read response"), 0); }