diff mbox series

[v5,1/4] crypto: luks: Fix tiny memory leak

Message ID 20201209203326.879381-2-mlevitsk@redhat.com (mailing list archive)
State New, archived
Headers show
Series qcow2: don't leave partially initialized file on image creation | expand

Commit Message

Maxim Levitsky Dec. 9, 2020, 8:33 p.m. UTC
When the underlying block device doesn't support the
bdrv_co_delete_file interface, an 'Error' object was leaked.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
 block/crypto.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Vladimir Sementsov-Ogievskiy Dec. 10, 2020, 10:28 a.m. UTC | #1
09.12.2020 23:33, Maxim Levitsky wrote:
> When the underlying block device doesn't support the
> bdrv_co_delete_file interface, an 'Error' object was leaked.
> 
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   block/crypto.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/block/crypto.c b/block/crypto.c
> index aef5a5721a..b3a5275132 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -735,6 +735,8 @@ fail:
>            */
>           if ((r_del < 0) && (r_del != -ENOTSUP)) {
>               error_report_err(local_delete_err);
> +        } else {
> +            error_free(local_delete_err);
>           }
>       }
>   
>
diff mbox series

Patch

diff --git a/block/crypto.c b/block/crypto.c
index aef5a5721a..b3a5275132 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -735,6 +735,8 @@  fail:
          */
         if ((r_del < 0) && (r_del != -ENOTSUP)) {
             error_report_err(local_delete_err);
+        } else {
+            error_free(local_delete_err);
         }
     }