[gnome-calendar] source-dialog: plug two memory leaks



commit 4c84cfbbdb5479124968ee0f077a186d970c091b
Author: Florian Brosch <flo brosch gmail com>
Date:   Tue Nov 7 00:35:08 2017 +0100

    source-dialog: plug two memory leaks

 src/gcal-source-dialog.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index fc7dd2f..1317d02 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -976,15 +976,16 @@ static void
 calendar_file_selected (GtkFileChooser *button,
                         gpointer        user_data)
 {
+  g_autofree gchar* display_name = NULL;
+  g_autoptr (ESource) source = NULL;
+  g_autoptr (GFile) file = NULL;
   GcalSourceDialog *self;
   ESourceExtension *ext;
-  ESource *source;
-  GFile *file;
 
   self = GCAL_SOURCE_DIALOG (user_data);
   file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
 
-  if (file == NULL)
+  if (!file)
     return;
 
   /**
@@ -1001,7 +1002,8 @@ calendar_file_selected (GtkFileChooser *button,
   e_source_local_set_custom_file (E_SOURCE_LOCAL (ext), file);
 
   /* update the source properties */
-  e_source_set_display_name (source, g_file_get_basename (file));
+  display_name = g_file_get_basename (file);
+  e_source_set_display_name (source, display_name);
 
   /* Jump to the edit page */
   gcal_source_dialog_set_source (GCAL_SOURCE_DIALOG (user_data), source);


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