diff mbox

[2/2] blkverify: Fix BDS leak in .bdrv_open error path

Message ID 1444738660-18285-3-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf Oct. 13, 2015, 12:17 p.m. UTC
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/blkverify.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jeff Cody Oct. 13, 2015, 12:35 p.m. UTC | #1
On Tue, Oct 13, 2015 at 02:17:40PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/blkverify.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/blkverify.c b/block/blkverify.c
> index f8655ad..c5f8e8d 100644
> --- a/block/blkverify.c
> +++ b/block/blkverify.c
> @@ -143,6 +143,9 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
>  
>      ret = 0;
>  fail:
> +    if (ret < 0) {
> +        bdrv_unref_child(bs, bs->file);
> +    }
>      qemu_opts_del(opts);
>      return ret;
>  }
> -- 
> 1.8.3.1
>

Reviewed-by: Jeff Cody <jcody@redhat.com>
diff mbox

Patch

diff --git a/block/blkverify.c b/block/blkverify.c
index f8655ad..c5f8e8d 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -143,6 +143,9 @@  static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
 
     ret = 0;
 fail:
+    if (ret < 0) {
+        bdrv_unref_child(bs, bs->file);
+    }
     qemu_opts_del(opts);
     return ret;
 }