mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Fix misc memory handling bugs
This commit is contained in:
parent
83a618f807
commit
9a47149559
@ -1,3 +1,12 @@
|
||||
Wed Apr 1 11:18:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Misc memory handling fixes
|
||||
* src/node_device.c: Don't strdup() a NULL parent device name
|
||||
* src/qemu_conf.c: Don't try to access() a NULL alternative
|
||||
binary name
|
||||
* src/storage_conf.c: Don't free mode string while its still
|
||||
in use
|
||||
|
||||
Wed Apr 1 11:16:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/xm_internal.c: Add support for vifname= parameter in
|
||||
|
@ -175,9 +175,14 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = strdup(obj->def->parent);
|
||||
if (!ret)
|
||||
virReportOOMError(dev->conn);
|
||||
if (obj->def->parent) {
|
||||
ret = strdup(obj->def->parent);
|
||||
if (!ret)
|
||||
virReportOOMError(dev->conn);
|
||||
} else {
|
||||
virNodeDeviceReportError(dev->conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("no parent for this device"));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (obj)
|
||||
|
@ -269,7 +269,7 @@ qemudCapsInitGuest(virCapsPtr caps,
|
||||
* which can be used with magic cpu choice
|
||||
*/
|
||||
hasbase = (access(info->binary, X_OK) == 0);
|
||||
hasaltbase = (access(info->altbinary, X_OK) == 0);
|
||||
hasaltbase = (info->altbinary && access(info->altbinary, X_OK) == 0);
|
||||
|
||||
/* Can use acceleration for KVM/KQEMU if
|
||||
* - host & guest arches match
|
||||
|
@ -401,12 +401,13 @@ virStorageDefParsePerms(virConnectPtr conn,
|
||||
} else {
|
||||
char *end = NULL;
|
||||
perms->mode = strtol(mode, &end, 8);
|
||||
VIR_FREE(mode);
|
||||
if (*end || perms->mode < 0 || perms->mode > 0777) {
|
||||
VIR_FREE(mode);
|
||||
virStorageReportError(conn, VIR_ERR_XML_ERROR,
|
||||
"%s", _("malformed octal mode"));
|
||||
goto error;
|
||||
}
|
||||
VIR_FREE(mode);
|
||||
}
|
||||
|
||||
if (virXPathNode(conn, "./owner", ctxt) == NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user