From 7173e3f80d5009f08763d644889ecb4a8795881a Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Mon, 11 Jan 2010 16:56:18 +0000 Subject: [PATCH] Add patch 04_opendir_leak.patch: cpulimit was leaking opendir() handles. Thanks to Johan Walles for the bug report and the patch (closes: #564517). --- debian/changelog | 7 ++++++ debian/patches/04_opendir_leak.patch | 33 ++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 41 insertions(+) create mode 100644 debian/patches/04_opendir_leak.patch diff --git a/debian/changelog b/debian/changelog index 7607157..e13b12d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +cpulimit (1.1-13) UNRELEASED; urgency=low + + * Add patch 04_opendir_leak.patch: cpulimit was leaking opendir() handles. + Thanks to Johan Walles for the bug report and the patch (closes: #564517). + + -- gregor herrmann Mon, 11 Jan 2010 17:52:52 +0100 + cpulimit (1.1-12) unstable; urgency=low * Add 03_Makefile.patch: allows to set CFLAGS; use CFLAGS in diff --git a/debian/patches/04_opendir_leak.patch b/debian/patches/04_opendir_leak.patch new file mode 100644 index 0000000..2c6b098 --- /dev/null +++ b/debian/patches/04_opendir_leak.patch @@ -0,0 +1,33 @@ +Author: Johan Walles +Bug-Debian: http://bugs.debian.org/564517 +Description: Each time cpulimit finds a process to limit, it does a goto + past the call to closedir(). Plug that leak. +Forwarded: yes +Origin: vendor, cf. bug +Reviewed-By: gregor herrmann +Last-Update: 2010-01-11 + +--- a/cpulimit.c ++++ b/cpulimit.c +@@ -98,6 +98,10 @@ + //pid detected + if (kill(pid,SIGSTOP)==0 && kill(pid,SIGCONT)==0) { + //process is ok! ++ if (closedir(dip) == -1) { ++ perror("closedir"); ++ return -1; ++ } + goto done; + } + else { +@@ -188,6 +192,10 @@ + if (found==1) { + if (kill(pid,SIGSTOP)==0 && kill(pid,SIGCONT)==0) { + //process is ok! ++ if (closedir(dip) == -1) { ++ perror("closedir"); ++ return -1; ++ } + goto done; + } + else { diff --git a/debian/patches/series b/debian/patches/series index 382c97c..a8afbb7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 01_priority.patch 02_segfault_longoptions.patch 03_Makefile.patch +04_opendir_leak.patch -- 2.30.2