diff options
author | Liam Merwick <Liam.Merwick@oracle.com> | 2018-11-05 21:38:37 +0000 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2018-11-12 17:49:21 +0100 |
commit | 2e2db260093d44130a8a2974aed3cc8149c0a08d (patch) | |
tree | e3bfe57726175510a239a1cc4a696eb18df30d3f /qemu-img.c | |
parent | 602414d1232723d92836babe8d7014b57b93e4d9 (diff) |
qemu-img: assert block_job_get() does not return NULL in img_commit()
Although the function block_job_get() can return NULL, it would be a
serious bug if it did so (because the job yields before executing anything
(if it started successfully); but otherwise, commit_active_start() would
have returned an error). However, as a precaution, before dereferencing
the 'job' pointer in img_commit() assert it is not NULL.
Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 1541453919-25973-4-git-send-email-Liam.Merwick@oracle.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c index 4c96db7ba4..13a6ca31b4 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1029,6 +1029,7 @@ static int img_commit(int argc, char **argv) } job = block_job_get("commit"); + assert(job); run_block_job(job, &local_err); if (local_err) { goto unref_backing; |