forked from enlightenment/efl
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
This commit is contained in:
parent
fa0fd8214f
commit
de389fbe5e
|
@ -953,8 +953,10 @@ _prg_full_path_guess(const char *prg)
|
||||||
{
|
{
|
||||||
char full_path[PATH_];
|
char full_path[PATH_];
|
||||||
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
||||||
char *paths = strdup(getenv("PATH"));
|
char *env_path = strdup(getenv("PATH"));
|
||||||
Eina_Stringshare *ret = NULL;
|
Eina_Stringshare *ret = NULL;
|
||||||
|
char *paths = env_path;
|
||||||
|
|
||||||
while (paths && *paths && !ret)
|
while (paths && *paths && !ret)
|
||||||
{
|
{
|
||||||
char *real_path;
|
char *real_path;
|
||||||
|
@ -973,6 +975,7 @@ _prg_full_path_guess(const char *prg)
|
||||||
paths += strlen(paths);
|
paths += strlen(paths);
|
||||||
if (colon) paths++;
|
if (colon) paths++;
|
||||||
}
|
}
|
||||||
|
free(env_path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,10 @@ _prg_full_path_guess(const char *prg)
|
||||||
{
|
{
|
||||||
char full_path[MAX_PATH];
|
char full_path[MAX_PATH];
|
||||||
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
||||||
char *paths = strdup(getenv("PATH"));
|
char *env_path = strdup(getenv("PATH"));
|
||||||
Eina_Stringshare *ret = NULL;
|
Eina_Stringshare *ret = NULL;
|
||||||
|
char *paths = env_path;
|
||||||
|
|
||||||
while (paths && *paths && !ret)
|
while (paths && *paths && !ret)
|
||||||
{
|
{
|
||||||
char *real_path;
|
char *real_path;
|
||||||
|
@ -325,6 +327,7 @@ _prg_full_path_guess(const char *prg)
|
||||||
paths += strlen(paths);
|
paths += strlen(paths);
|
||||||
if (colon) paths++;
|
if (colon) paths++;
|
||||||
}
|
}
|
||||||
|
free(env_path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue