cleanup: remove useless if-before-VIR_FREE

* Makefile.cfg (useless_free_options): Also check for VIR_FREE.
* src/iptables.c (iptRulesFree): Remove useless if-before-VIR_FREE.
* src/remote_internal.c (remoteAuthSASL): Likewise.
* src/test.c (testOpenFromFile): Likewise.
This commit is contained in:
Jim Meyering 2009-02-03 13:08:07 +00:00
parent d26c3387df
commit c18ccff446
5 changed files with 17 additions and 16 deletions

View File

@ -1,3 +1,11 @@
Tue, 3 Feb 2009 14:06:05 +0100 Jim Meyering <meyering@redhat.com>
cleanup: remove useless if-before-VIR_FREE
* Makefile.cfg (useless_free_options): Also check for VIR_FREE.
* src/iptables.c (iptRulesFree): Remove useless if-before-VIR_FREE.
* src/remote_internal.c (remoteAuthSASL): Likewise.
* src/test.c (testOpenFromFile): Likewise.
Mon, 2 Feb 2009 21:33:57 +0100 Jim Meyering <meyering@redhat.com> Mon, 2 Feb 2009 21:33:57 +0100 Jim Meyering <meyering@redhat.com>
tests: diagnose more open failures tests: diagnose more open failures

View File

@ -59,6 +59,7 @@ local-checks-to-skip = \
useless_free_options = \ useless_free_options = \
--name=sexpr_free \ --name=sexpr_free \
--name=VIR_FREE \
--name=xmlFree \ --name=xmlFree \
--name=xmlXPathFreeContext \ --name=xmlXPathFreeContext \
--name=xmlXPathFreeObject --name=xmlXPathFreeObject

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007, 2008 Red Hat, Inc. * Copyright (C) 2007-2009 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -325,11 +325,8 @@ iptRulesFree(iptRules *rules)
{ {
int i; int i;
if (rules->table) VIR_FREE(rules->table);
VIR_FREE(rules->table); VIR_FREE(rules->chain);
if (rules->chain)
VIR_FREE(rules->chain);
if (rules->rules) { if (rules->rules) {
for (i = 0; i < rules->nrules; i++) for (i = 0; i < rules->nrules; i++)

View File

@ -5388,9 +5388,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
goto cleanup; goto cleanup;
} }
if (serverin) { VIR_FREE(serverin);
VIR_FREE(serverin);
}
DEBUG("Client step result %d. Data %d bytes %p", err, clientoutlen, clientout); DEBUG("Client step result %d. Data %d bytes %p", err, clientoutlen, clientout);
/* Previous server call showed completion & we're now locally complete too */ /* Previous server call showed completion & we're now locally complete too */

View File

@ -1,7 +1,7 @@
/* /*
* test.c: A "mock" hypervisor for use by application unit tests * test.c: A "mock" hypervisor for use by application unit tests
* *
* Copyright (C) 2006-2008 Red Hat, Inc. * Copyright (C) 2006-2009 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2006 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -509,8 +509,7 @@ static int testOpenFromFile(virConnectPtr conn,
dom->persistent = 1; dom->persistent = 1;
virDomainObjUnlock(dom); virDomainObjUnlock(dom);
} }
if (domains != NULL) VIR_FREE(domains);
VIR_FREE(domains);
ret = virXPathNodeSet(conn, "/node/network", ctxt, &networks); ret = virXPathNodeSet(conn, "/node/network", ctxt, &networks);
if (ret < 0) { if (ret < 0) {
@ -544,8 +543,7 @@ static int testOpenFromFile(virConnectPtr conn,
net->persistent = 1; net->persistent = 1;
virNetworkObjUnlock(net); virNetworkObjUnlock(net);
} }
if (networks != NULL) VIR_FREE(networks);
VIR_FREE(networks);
/* Parse Storage Pool list */ /* Parse Storage Pool list */
ret = virXPathNodeSet(conn, "/node/pool", ctxt, &pools); ret = virXPathNodeSet(conn, "/node/pool", ctxt, &pools);
@ -599,8 +597,7 @@ static int testOpenFromFile(virConnectPtr conn,
pool->active = 1; pool->active = 1;
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
} }
if (pools != NULL) VIR_FREE(pools);
VIR_FREE(pools);
xmlXPathFreeContext(ctxt); xmlXPathFreeContext(ctxt);
xmlFreeDoc(xml); xmlFreeDoc(xml);