fix more elm config file pointer access 58/45758/3
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 17 Jun 2015 07:54:08 +0000 (16:54 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 11 Aug 2015 06:09:45 +0000 (23:09 -0700)
again - follow up from changes to config code to fix seg

Change-Id: Ib20914228cab72e3fc9880c38395fa8e68eb80ee
origin: upstream

src/lib/elm_config.c

index 2891658..08eb2a6 100644 (file)
@@ -3106,6 +3106,8 @@ elm_config_audio_mute_set(Edje_Channel channel, Eina_Bool mute)
 EAPI void
 elm_config_all_flush(void)
 {
+   FILE *f;
+
 #ifdef HAVE_ELEMENTARY_X
    if (ecore_x_display_get())
      ecore_x_window_prop_string_set(_config_win, _atom[ATOM_E_PROFILE],
@@ -3115,9 +3117,12 @@ elm_config_all_flush(void)
 
    _elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s/flush",
                           _elm_profile);
-   FILE *fp = fopen(buf, "w+");
-   fprintf(fp, "flush");
-   fclose(fp);
+   f = fopen(buf, "w+");
+   if (f)
+     {
+        fprintf(f, "flush");
+        fclose(f);
+     }
 }
 
 static void