Skip to content

Commit 530f292

Browse files
committed
termux-api: free malloc'ed child_argv array on execv error
We exit right after so this is not exactly strictly necessary, but that might change at some point and is good practise in any case.
1 parent a0e1c71 commit 530f292

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

termux-api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ _Noreturn void exec_am_broadcast(int argc, char** argv,
275275
// Use an a executable taking care of PATH and LD_LIBRARY_PATH:
276276
execv(PREFIX "/bin/am", child_argv);
277277

278+
// We should not reach here, if we do, then free memory we malloc'ed
279+
free(child_argv);
278280
perror("execv(\"" PREFIX "/bin/am\")");
279281
exit(1);
280282
}

0 commit comments

Comments
 (0)