mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemuMonitorTextAttachDrive: avoid two leaks
* src/qemu/qemu_monitor_text.c (qemuMonitorTextAttachDrive): Most other failures in this function would "goto cleanup", but one mistakenly returned directly, skipping the cleanup and resulting in a leak. In addition, iterating the "try_command" loop would clobber, and thus leak, the "cmd" allocated on the first iteration, so be careful to free it in addition to "reply" beforehand.
This commit is contained in:
parent
731c738652
commit
1af75828a0
@ -1881,13 +1881,13 @@ try_command:
|
||||
if (qemudParseDriveAddReply(reply, driveAddr) < 0) {
|
||||
if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
|
||||
VIR_FREE(reply);
|
||||
VIR_FREE(cmd);
|
||||
tryOldSyntax = 1;
|
||||
goto try_command;
|
||||
}
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed: %s"), drivestr, reply);
|
||||
VIR_FREE(reply);
|
||||
return -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user