eina_vpath: fix the memory leak
authorTaehyub Kim <taehyub.kim@samsung.com>
Fri, 21 Sep 2018 06:05:58 +0000 (15:05 +0900)
committerYeongjong Lee <yj34.lee@samsung.com>
Fri, 28 Sep 2018 01:23:59 +0000 (10:23 +0900)
Summary:
 fix the memory leak
@fix

Reviewers: Jaehyun_Cho, bu5hm4n

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7081

src/lib/eina/eina_vpath.c

index a5da2f1..4be436d 100644 (file)
@@ -176,12 +176,16 @@ _eina_vpath_interface_sys_init(void)
    // $HOME / ~/ etc.
    home = eina_environment_home_get();
    if (!home)
-     home = _fallback_home_dir();
+     {
+        home = _fallback_home_dir();
+        _eina_vpath_data_add("home", home);
+        free(home);
+     }
+   else
+     _eina_vpath_data_add("home", home);
 
    // tmp dir - system wide
    tmp = eina_environment_tmp_get();
-
-   _eina_vpath_data_add("home", home);
    _eina_vpath_data_add("tmp", tmp);
 }