The function block_job_get() may return NULL so before dereferencing
the 'job' pointer in img_commit() it should be checked.
Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
Reviewed-by: Darren Kenny <Darren.Kenny@oracle.com>
Reviewed-by: Mark Kanda <Mark.Kanda@oracle.com>
---
qemu-img.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index b12f4cd19b0a..51fe09bd08ed 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1029,6 +1029,9 @@ static int img_commit(int argc, char **argv)
}
job = block_job_get("commit");
+ if (job == NULL) {
+ goto unref_backing;
+ }
run_block_job(job, &local_err);
if (local_err) {
goto unref_backing;
--
1.8.3.1