remove useless code

* src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
after failed strdup.
* src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
after VIR_FREE(*group).
* src/lxc_driver.c (lxcShutdown): Likewise.
* src/xen_unified.c (xenUnifiedClose): Likewise.
* src/xm_internal.c (xenXMDomainConfigFormat): Rewrite disk-
and net-config-setting code to be clearer.
This commit is contained in:
Jim Meyering 2009-02-05 16:03:11 +00:00
parent 7faa50d1db
commit a9aa76bad5
6 changed files with 24 additions and 18 deletions

View File

@ -1,3 +1,15 @@
Thu Feb 5 17:00:17 +0100 2009 Jim Meyering <meyering@redhat.com>
remove useless code
* src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
after failed strdup.
* src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
after VIR_FREE(*group).
* src/lxc_driver.c (lxcShutdown): Likewise.
* src/xen_unified.c (xenUnifiedClose): Likewise.
* src/xm_internal.c (xenXMDomainConfigFormat): Rewrite disk-
and net-config-setting code to be clearer.
Wed Feb 4 22:22:34 +0100 2009 Jim Meyering <meyering@redhat.com>
lxc_container: Don't dereference NULL upon failure

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007 Red Hat, Inc.
* Copyright (C) 2007, 2009 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -539,10 +539,8 @@ brAddTap(brControl *ctl,
if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
goto error;
VIR_FREE(*ifname);
if (!(*ifname = strdup(try.ifr_name))) {
errno = ENOMEM;
if (!(*ifname = strdup(try.ifr_name)))
goto error;
}
*tapfd = fd;
return 0;
}

View File

@ -51,7 +51,6 @@ void virCgroupFree(virCgroupPtr *group)
if (*group != NULL) {
VIR_FREE((*group)->path);
VIR_FREE(*group);
*group = NULL;
}
}

View File

@ -1238,7 +1238,6 @@ static int lxcShutdown(void)
lxcDriverUnlock(lxc_driver);
virMutexDestroy(&lxc_driver->lock);
VIR_FREE(lxc_driver);
lxc_driver = NULL;
return 0;
}

View File

@ -399,7 +399,6 @@ xenUnifiedClose (virConnectPtr conn)
virMutexDestroy(&priv->lock);
VIR_FREE(conn->privateData);
conn->privateData = NULL;
return 0;
}

View File

@ -2233,14 +2233,13 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
hvm, priv->xendConfigVersion) < 0)
goto cleanup;
}
if (diskVal->list == NULL)
VIR_FREE(diskVal);
else if (virConfSetValue(conf, "disk", diskVal) < 0) {
if (diskVal->list != NULL) {
int ret = virConfSetValue(conf, "disk", diskVal);
diskVal = NULL;
goto no_memory;
if (ret < 0)
goto no_memory;
}
diskVal = NULL;
VIR_FREE(diskVal);
if (VIR_ALLOC(netVal) < 0)
goto no_memory;
@ -2253,13 +2252,13 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
hvm) < 0)
goto cleanup;
}
if (netVal->list == NULL)
VIR_FREE(netVal);
else if (virConfSetValue(conf, "vif", netVal) < 0) {
if (netVal->list != NULL) {
int ret = virConfSetValue(conf, "vif", netVal);
netVal = NULL;
goto no_memory;
if (ret < 0)
goto no_memory;
}
netVal = NULL;
VIR_FREE(netVal);
if (hvm) {
if (def->nparallels) {