summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-02-25 11:42:17 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-02-26 15:15:45 +0100
commitde389fbe5e5f4f46808dabd92ca291e1a41077cd (patch)
tree85d3327f8ab017263eca7a751f51757decb3ed0d /src/bin
parentfa0fd8214f9db72413738686b81bb8a0576528c2 (diff)
exactness: avoid leak on leaving scope
Before we leave the fucntion here we need to free our temporaray paths variable. CID: 1419860 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11411
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/exactness/player.c5
-rw-r--r--src/bin/exactness/recorder.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index 048232e537..0e88914406 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -953,8 +953,10 @@ _prg_full_path_guess(const char *prg)
953{ 953{
954 char full_path[PATH_]; 954 char full_path[PATH_];
955 if (strchr(prg, '/')) return eina_stringshare_add(prg); 955 if (strchr(prg, '/')) return eina_stringshare_add(prg);
956 char *paths = strdup(getenv("PATH")); 956 char *env_path = strdup(getenv("PATH"));
957 Eina_Stringshare *ret = NULL; 957 Eina_Stringshare *ret = NULL;
958 char *paths = env_path;
959
958 while (paths && *paths && !ret) 960 while (paths && *paths && !ret)
959 { 961 {
960 char *real_path; 962 char *real_path;
@@ -973,6 +975,7 @@ _prg_full_path_guess(const char *prg)
973 paths += strlen(paths); 975 paths += strlen(paths);
974 if (colon) paths++; 976 if (colon) paths++;
975 } 977 }
978 free(env_path);
976 return ret; 979 return ret;
977} 980}
978 981
diff --git a/src/bin/exactness/recorder.c b/src/bin/exactness/recorder.c
index 5b529b5b8c..c3f1ced58b 100644
--- a/src/bin/exactness/recorder.c
+++ b/src/bin/exactness/recorder.c
@@ -305,8 +305,10 @@ _prg_full_path_guess(const char *prg)
305{ 305{
306 char full_path[MAX_PATH]; 306 char full_path[MAX_PATH];
307 if (strchr(prg, '/')) return eina_stringshare_add(prg); 307 if (strchr(prg, '/')) return eina_stringshare_add(prg);
308 char *paths = strdup(getenv("PATH")); 308 char *env_path = strdup(getenv("PATH"));
309 Eina_Stringshare *ret = NULL; 309 Eina_Stringshare *ret = NULL;
310 char *paths = env_path;
311
310 while (paths && *paths && !ret) 312 while (paths && *paths && !ret)
311 { 313 {
312 char *real_path; 314 char *real_path;
@@ -325,6 +327,7 @@ _prg_full_path_guess(const char *prg)
325 paths += strlen(paths); 327 paths += strlen(paths);
326 if (colon) paths++; 328 if (colon) paths++;
327 } 329 }
330 free(env_path);
328 return ret; 331 return ret;
329} 332}
330 333