+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
/*
- * 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
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;
}
if (*group != NULL) {
VIR_FREE((*group)->path);
VIR_FREE(*group);
- *group = NULL;
}
}
lxcDriverUnlock(lxc_driver);
virMutexDestroy(&lxc_driver->lock);
VIR_FREE(lxc_driver);
- lxc_driver = NULL;
return 0;
}
virMutexDestroy(&priv->lock);
VIR_FREE(conn->privateData);
- conn->privateData = NULL;
return 0;
}
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;
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) {