Fix memory leak in run_hook()
Fixes GitHub issue #139. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
7f448ee8cd
commit
5efc334c1b
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
int run_hook(const char *name)
|
int run_hook(const char *name)
|
||||||
{
|
{
|
||||||
char *hook_path;
|
char *hook_path = NULL;
|
||||||
char const *arg[2];
|
char const *arg[2];
|
||||||
int pid, ret = -127;
|
int pid, ret = -127;
|
||||||
int prepare_wins = (ui_mode == UI_CURSES);
|
int prepare_wins = (ui_mode == UI_CURSES);
|
||||||
@ -50,7 +50,7 @@ int run_hook(const char *name)
|
|||||||
arg[1] = NULL;
|
arg[1] = NULL;
|
||||||
|
|
||||||
if (!io_file_exists(hook_path))
|
if (!io_file_exists(hook_path))
|
||||||
return 0;
|
goto cleanup;
|
||||||
|
|
||||||
if (prepare_wins)
|
if (prepare_wins)
|
||||||
wins_prepare_external();
|
wins_prepare_external();
|
||||||
@ -64,5 +64,7 @@ int run_hook(const char *name)
|
|||||||
if (prepare_wins)
|
if (prepare_wins)
|
||||||
wins_unprepare_external();
|
wins_unprepare_external();
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
mem_free(hook_path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user