mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +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>
|
Wed Apr 1 11:16:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/xm_internal.c: Add support for vifname= parameter in
|
* src/xm_internal.c: Add support for vifname= parameter in
|
||||||
|
@ -175,9 +175,14 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = strdup(obj->def->parent);
|
if (obj->def->parent) {
|
||||||
if (!ret)
|
ret = strdup(obj->def->parent);
|
||||||
virReportOOMError(dev->conn);
|
if (!ret)
|
||||||
|
virReportOOMError(dev->conn);
|
||||||
|
} else {
|
||||||
|
virNodeDeviceReportError(dev->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
"%s", _("no parent for this device"));
|
||||||
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (obj)
|
if (obj)
|
||||||
|
@ -269,7 +269,7 @@ qemudCapsInitGuest(virCapsPtr caps,
|
|||||||
* which can be used with magic cpu choice
|
* which can be used with magic cpu choice
|
||||||
*/
|
*/
|
||||||
hasbase = (access(info->binary, X_OK) == 0);
|
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
|
/* Can use acceleration for KVM/KQEMU if
|
||||||
* - host & guest arches match
|
* - host & guest arches match
|
||||||
|
@ -401,12 +401,13 @@ virStorageDefParsePerms(virConnectPtr conn,
|
|||||||
} else {
|
} else {
|
||||||
char *end = NULL;
|
char *end = NULL;
|
||||||
perms->mode = strtol(mode, &end, 8);
|
perms->mode = strtol(mode, &end, 8);
|
||||||
VIR_FREE(mode);
|
|
||||||
if (*end || perms->mode < 0 || perms->mode > 0777) {
|
if (*end || perms->mode < 0 || perms->mode > 0777) {
|
||||||
|
VIR_FREE(mode);
|
||||||
virStorageReportError(conn, VIR_ERR_XML_ERROR,
|
virStorageReportError(conn, VIR_ERR_XML_ERROR,
|
||||||
"%s", _("malformed octal mode"));
|
"%s", _("malformed octal mode"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
VIR_FREE(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virXPathNode(conn, "./owner", ctxt) == NULL) {
|
if (virXPathNode(conn, "./owner", ctxt) == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user