[retro-gtk] module-iterator: Steal the pointer we auto clean up



commit fdaa1ec49233043efdb008156031545dbaac6224
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Dec 28 08:57:11 2020 +0100

    module-iterator: Steal the pointer we auto clean up
    
    This steals a pointer we auto cleanup as the hash table takes possession
    of it, solving a double free issue.

 retro-gtk/retro-module-iterator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/retro-gtk/retro-module-iterator.c b/retro-gtk/retro-module-iterator.c
index 03ffdc5..939ac4a 100644
--- a/retro-gtk/retro-module-iterator.c
+++ b/retro-gtk/retro-module-iterator.c
@@ -92,7 +92,7 @@ set_current_directory_as_visited (RetroModuleIterator *self)
 
   current_directory_file = g_file_new_for_path (self->directories[self->current_directory]);
   current_directory_path = g_file_get_path (current_directory_file);
-  g_hash_table_add (self->visited, current_directory_path);
+  g_hash_table_add (self->visited, g_steal_pointer (&current_directory_path));
 }
 
 static gboolean


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