diff mbox

block: Fix leak of ignore_children in error path

Message ID 20180315035157.6929-1-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng March 15, 2018, 3:51 a.m. UTC
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake March 15, 2018, 12:25 p.m. UTC | #1
On 03/14/2018 10:51 PM, Fam Zheng wrote:
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   block.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/block.c b/block.c
> index 75a9fd49de..c1fda9fd57 100644
> --- a/block.c
> +++ b/block.c
> @@ -3671,12 +3671,12 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
>           GSList *ignore_children = g_slist_prepend(NULL, c);
>           bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm,
>                                  ignore_children, &local_err);
> +        g_slist_free(ignore_children);
>           if (local_err) {
>               ret = -EPERM;
>               error_report_err(local_err);
>               goto exit;
>           }
> -        g_slist_free(ignore_children);
>   
>           /* If so, update the backing file path in the image file */
>           if (c->role->update_filename) {
>
Alberto Garcia March 15, 2018, 12:52 p.m. UTC | #2
On Thu 15 Mar 2018 04:51:57 AM CET, Fam Zheng wrote:
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto
Kevin Wolf March 15, 2018, 4:41 p.m. UTC | #3
Am 15.03.2018 um 04:51 hat Fam Zheng geschrieben:
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block.c b/block.c
index 75a9fd49de..c1fda9fd57 100644
--- a/block.c
+++ b/block.c
@@ -3671,12 +3671,12 @@  int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
         GSList *ignore_children = g_slist_prepend(NULL, c);
         bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm,
                                ignore_children, &local_err);
+        g_slist_free(ignore_children);
         if (local_err) {
             ret = -EPERM;
             error_report_err(local_err);
             goto exit;
         }
-        g_slist_free(ignore_children);
 
         /* If so, update the backing file path in the image file */
         if (c->role->update_filename) {