[glib/mcatanzaro/coverity: 8/8] gfileenumerator: fix leak in error path




commit 8bfc2998135ee9c4460520febb3af720c61438a5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Apr 1 14:13:19 2021 -0500

    gfileenumerator: fix leak in error path
    
    Found by Coverity.

 gio/gfileenumerator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gio/gfileenumerator.c b/gio/gfileenumerator.c
index ac2e4eb98..1f9bc24eb 100644
--- a/gio/gfileenumerator.c
+++ b/gio/gfileenumerator.c
@@ -787,7 +787,10 @@ next_files_thread (GTask        *task,
     }
 
   if (error)
-    g_task_return_error (task, error);
+    {
+      g_list_free_full (files, g_object_unref);
+      g_task_return_error (task, error);
+    }
   else
     g_task_return_pointer (task, files, (GDestroyNotify)next_async_op_free);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]