changeset 35931:dd2264983633

Make fsSelectedDirectory a local variable. Additionally, avoid memory leaks by using the variable instead of calling get_current_dir_name() again and by freeing fsSelectedDirectory.
author ib
date Wed, 20 Mar 2013 17:33:42 +0000
parents 9f25b60fa81b
children f4040eda9fcb
files gui/dialog/fileselect.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/fileselect.c	Wed Mar 20 12:18:54 2013 +0000
+++ b/gui/dialog/fileselect.c	Wed Mar 20 17:33:42 2013 +0000
@@ -57,7 +57,6 @@
 #endif
 
 char          * fsSelectedFile = NULL;
-char          * fsSelectedDirectory = NULL;
 gchar         * fsSelectedDirectoryUtf8 = NULL;
 unsigned char * fsThatDir = ".";
 const gchar   * fsFilter = "*";
@@ -498,6 +497,7 @@
 
 static void fs_Ok_released( GtkButton * button, gpointer user_data )
 {
+ char          * fsSelectedDirectory;
  GList         * item;
  int             i = 1, l;
  struct stat     fs;
@@ -530,7 +530,7 @@
             g_free(selected);
           }
           guiInfo.NewPlay=GUI_FILE_NEW; sub_fps=0;
-          fs_PersistantHistory( get_current_dir_name() );      //totem, write into history
+          fs_PersistantHistory( fsSelectedDirectory );
           break;
    case fsSubtitleSelector:
           setddup( &guiInfo.SubtitleFilename,fsSelectedDirectory,fsSelectedFile );
@@ -562,6 +562,9 @@
    fsTopList_items=g_list_prepend( fsTopList_items,fsSelectedDirectoryUtf8 );
    g_hash_table_insert(fsPathTable, strdup(fsSelectedDirectoryUtf8), strdup(fsSelectedDirectory));
  }
+
+ free(fsSelectedDirectory);
+
  if ( uiLoadPlay ) { uiLoadPlay=False; uiEvent( evPlay,0 ); }
   else gui( GUI_SET_STATE,(void *) GUI_STOP );
 }