vmspawn: don't leak the job id if sending blockdev-create fails
The job map owns its keys, but the error path added in commit 1d0a8e5dbd
only frees the value when it unregisters the job. Free the key as well,
like dispatch_pending_job() does.
Signed-off-by: Martin Pitt <martin@amutable.com>
(cherry picked from commit 67b4f43a54f29b3c0fd5a455b4f956613eae8668)
This commit is contained in:
committed by
Luca Boccassi
parent
fddede73c7
commit
cb2f3814bb
@@ -681,7 +681,8 @@ static int qmp_setup_ephemeral_drive(VmspawnQmpBridge *bridge, QmpClient *qmp, D
|
||||
|
||||
r = qmp_client_invoke(qmp, /* ret_slot= */ NULL, "blockdev-create", QMP_CLIENT_ARGS(cmd_args), on_qmp_complete, (void*) "blockdev-create");
|
||||
if (r < 0) {
|
||||
_unused_ _cleanup_(pending_job_freep) PendingJob *dead = hashmap_remove(bridge->pending_jobs, job_id);
|
||||
_cleanup_free_ char *key = NULL;
|
||||
_unused_ _cleanup_(pending_job_freep) PendingJob *dead = hashmap_remove2(bridge->pending_jobs, job_id, (void**) &key);
|
||||
return log_error_errno(r, "Failed to send blockdev-create for '%s': %m", drive->path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user