watchdog/0002-mem-leak-verbose.patch

20 lines
758 B
Diff
Raw Normal View History

diff -ruNp a/src/run-as-child.c b/src/run-as-child.c
--- a/src/run-as-child.c 2021-10-14 08:17:04.556107815 +0200
+++ b/src/run-as-child.c 2021-10-14 08:36:23.686706344 +0200
@@ -98,8 +98,14 @@ int exec_as_func(int flags, void *ptr)
/* Create single string with all command line options. */
int ii = 1;
char *opt = strdup(":");
+ char *tempOpt;
while (opt != NULL && arg[ii] != NULL) {
- opt = realloc(opt, strlen(opt) + strlen(arg[ii]) + 2);
+ tempOpt = realloc(opt, strlen(opt) + strlen(arg[ii]) + 2);
+ if (tempOpt != NULL){
+ opt = tempOpt;
+ } else {
+ break;
+ }
opt = strcat(opt, " ");
opt = strcat(opt, arg[ii]);
ii++;