diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-04-14 12:59:55 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-05-25 19:04:21 +0200 |
commit | 91ab68837933232bcef99da7c968e6d41900419b (patch) | |
tree | 38ca3d8cc85a0fcd1cb4208214a8df76e944e38a /block/backup.c | |
parent | e253f4b89796967d03a455d1df2ae6bda8cc7d01 (diff) | |
download | qemu-91ab68837933232bcef99da7c968e6d41900419b.zip qemu-91ab68837933232bcef99da7c968e6d41900419b.tar.gz qemu-91ab68837933232bcef99da7c968e6d41900419b.tar.bz2 |
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>
Diffstat (limited to 'block/backup.c')
-rw-r--r-- | block/backup.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/block/backup.c b/block/backup.c index fec45e8..a990cf1 100644 --- a/block/backup.c +++ b/block/backup.c @@ -485,6 +485,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, { int64_t len; BlockDriverInfo bdi; + BackupBlockJob *job = NULL; int ret; assert(bs); @@ -542,8 +543,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, goto error; } - BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed, - cb, opaque, errp); + job = block_job_create(&backup_job_driver, bs, speed, cb, opaque, errp); if (!job) { goto error; } @@ -584,4 +584,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target, if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); } + if (job) { + block_job_unref(&job->common); + } } |