aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-07-10 13:42:35 +0200
committerKevin Wolf <kwolf@redhat.com>2017-07-18 15:14:35 +0200
commitb1e1fa0c3afc7f671fbc24645bdf67949a5657e5 (patch)
treea233d96194f1537e30769ab121b97b242ca221aa /block/commit.c
parent718d7f4f9cf772e5784093d8e6085680a235acdb (diff)
commit: Add NULL check for overlay_bs
I can't see how overlay_bs could become NULL with the current code, but other code in this function already checks it and we can make Coverity happy with this check, so let's add it. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/commit.c b/block/commit.c
index 13143608f8..5cc910f567 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -90,7 +90,9 @@ static void commit_complete(BlockJob *job, void *opaque)
/* Make sure overlay_bs and top stay around until bdrv_set_backing_hd() */
bdrv_ref(top);
- bdrv_ref(overlay_bs);
+ if (overlay_bs) {
+ bdrv_ref(overlay_bs);
+ }
/* Remove base node parent that still uses BLK_PERM_WRITE/RESIZE before
* the normal backing chain can be restored. */