[Qemu-devel] [PATCH] block/crypto: Fix memory leak in create error path

Kevin Wolf posted 1 patch 7 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180704125802.26394-1-kwolf@redhat.com
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x failed
block/crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] block/crypto: Fix memory leak in create error path
Posted by Kevin Wolf 7 years, 4 months ago
Fixes: Coverity CID 1393782
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/crypto.c b/block/crypto.c
index 994172a3de..146d81c90a 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -551,7 +551,7 @@ static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
     /* Create protocol layer */
     ret = bdrv_create_file(filename, opts, errp);
     if (ret < 0) {
-        return ret;
+        goto fail;
     }
 
     bs = bdrv_open(filename, NULL, NULL,
-- 
2.13.6


Re: [Qemu-devel] [PATCH] block/crypto: Fix memory leak in create error path
Posted by Daniel P. Berrangé 7 years, 4 months ago
On Wed, Jul 04, 2018 at 02:58:02PM +0200, Kevin Wolf wrote:
> Fixes: Coverity CID 1393782
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/crypto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/crypto.c b/block/crypto.c
> index 994172a3de..146d81c90a 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -551,7 +551,7 @@ static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
>      /* Create protocol layer */
>      ret = bdrv_create_file(filename, opts, errp);
>      if (ret < 0) {
> -        return ret;
> +        goto fail;
>      }
>  
>      bs = bdrv_open(filename, NULL, NULL,

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|