[MPlayer-cvslog] r36025 - trunk/gui/dialog/fileselect.c

ib subversion at mplayerhq.hu
Wed Mar 20 18:33:42 CET 2013


Author: ib
Date: Wed Mar 20 18:33:42 2013
New Revision: 36025

Log:
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.

Modified:
   trunk/gui/dialog/fileselect.c

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Wed Mar 20 13:18:54 2013	(r36024)
+++ trunk/gui/dialog/fileselect.c	Wed Mar 20 18:33:42 2013	(r36025)
@@ -57,7 +57,6 @@ char * get_current_dir_name( void );
 #endif
 
 char          * fsSelectedFile = NULL;
-char          * fsSelectedDirectory = NULL;
 gchar         * fsSelectedDirectoryUtf8 = NULL;
 unsigned char * fsThatDir = ".";
 const gchar   * fsFilter = "*";
@@ -498,6 +497,7 @@ static void fs_Up_released( GtkButton * 
 
 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 @@ static void fs_Ok_released( GtkButton * 
             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 @@ static void fs_Ok_released( GtkButton * 
    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 );
 }


More information about the MPlayer-cvslog mailing list