[gnome-notes] application: Fix possible memory leak



commit c783071738d3a9706d0fad1c676336ad891f6818
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Mon Feb 1 12:30:10 2021 +0530

    application: Fix possible memory leak
    
    and a possible invalid free

 src/bjb-application.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/bjb-application.c b/src/bjb-application.c
index 610baf5..dfa0567 100644
--- a/src/bjb-application.c
+++ b/src/bjb-application.c
@@ -199,15 +199,17 @@ bijiben_open (GApplication  *application,
 {
   BjbApplication *self;
   gint i;
-  g_autofree gchar *path = NULL;
 
   self = BJB_APPLICATION (application);
 
   for (i = 0; i < n_files; i++)
   {
+    g_autofree char *path = NULL;
+
     path = g_file_get_parse_name (files[i]);
     if (!bijiben_open_path (self, path, NULL))
-      g_queue_push_head (&self->files_to_open, path);
+      g_queue_push_head (&self->files_to_open,
+                         g_steal_pointer (&path));
   }
 }
 


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