diff --git a/0002-mem-leak-verbose.patch b/0002-mem-leak-verbose.patch new file mode 100644 index 0000000..2341c4b --- /dev/null +++ b/0002-mem-leak-verbose.patch @@ -0,0 +1,19 @@ +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++; diff --git a/watchdog.spec b/watchdog.spec index 7a84a0e..ba6a7a8 100644 --- a/watchdog.spec +++ b/watchdog.spec @@ -1,7 +1,7 @@ Summary: Software and/or Hardware watchdog daemon Name: watchdog Version: 5.16 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://sourceforge.net/projects/watchdog/ @@ -12,10 +12,12 @@ Source4: watchdog.service Source5: watchdog-ping.service # Fixes building on glibc without RPC. Sent upstream 2019-02-06. -Patch1: 0001-Choose-libtirpc-or-another-RPC-library-for-XDR-heade.patch +Patch1: 0001-Choose-libtirpc-or-another-RPC-library-for-XDR-heade.patch +# Fixes potentional mem leak +Patch2: 0002-mem-leak-verbose.patch # Non-upstream patch to document SELinux support. -Patch99: 0099-watchdog-5.16-rhseldoc.patch +Patch99: 0099-watchdog-5.16-rhseldoc.patch BuildRequires: make BuildRequires: gcc @@ -49,6 +51,7 @@ expiration) initiated by the BMC. %prep %setup -q -n %{name}-%{version} %patch1 -p1 +%patch2 -p1 %patch99 -p1 -b .rhseldoc autoreconf -i @@ -124,6 +127,9 @@ rm %{name}.sysconfig %changelog +* Thu Oct 14 2021 Josef Ridky - 5.16-2 +- fix memory leak when verbose mode is on + * Tue Aug 10 2021 Josef Ridky - 5.16-1 - New upstream release 5.16