Resolves: #2013934 - fix mem leak when verbose mode is on

This commit is contained in:
Josef Řídký 2021-10-14 09:47:33 +02:00
parent d7d8b27d08
commit c7152d55c9
2 changed files with 28 additions and 3 deletions

View File

@ -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++;

View File

@ -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 <jridky@redhat.com> - 5.16-2
- fix memory leak when verbose mode is on
* Tue Aug 10 2021 Josef Ridky <jridky@redhat.com> - 5.16-1
- New upstream release 5.16