backup: Don't leak BackupBlockJob in error path
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
(cherry picked from commit 91ab688379
)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
@@ -504,6 +504,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
{
|
{
|
||||||
int64_t len;
|
int64_t len;
|
||||||
BlockDriverInfo bdi;
|
BlockDriverInfo bdi;
|
||||||
|
BackupBlockJob *job = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
assert(bs);
|
assert(bs);
|
||||||
@@ -568,8 +569,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed,
|
job = block_job_create(&backup_job_driver, bs, speed, cb, opaque, errp);
|
||||||
cb, opaque, errp);
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -610,4 +610,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
|||||||
if (sync_bitmap) {
|
if (sync_bitmap) {
|
||||||
bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
|
bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
|
||||||
}
|
}
|
||||||
|
if (job) {
|
||||||
|
block_job_unref(&job->common);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user