Skip to contentSkip to conversation

block: Fix leak of ignore_children in error path

PATCH Applied Fam Zheng 4 participants 4 messages Mar 15, 2018

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 block: Fix leak of ignore_children in error path

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index 75a9fd49de..c1fda9fd57 100644
@@ -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) {
Signature · 1 line
2.14.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Fam Zheng
---
  block.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 20 lines
block.c +1 -1
index 75a9fd49de..c1fda9fd57 100644
@@ -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) {
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org