Add patch 04_opendir_leak.patch: cpulimit was leaking opendir() handles.
authorgregor herrmann <gregoa@debian.org>
Mon, 11 Jan 2010 16:56:18 +0000 (16:56 -0000)
committergregor herrmann <gregoa@debian.org>
Mon, 11 Jan 2010 16:56:18 +0000 (16:56 -0000)
Thanks to Johan Walles for the bug report and the patch (closes: #564517).

debian/changelog
debian/patches/04_opendir_leak.patch [new file with mode: 0644]
debian/patches/series

index 760715787747926bd1b12983548c0b91f6571846..e13b12dfb72e9cb960ceae97e198e8fefd527da1 100644 (file)
@@ -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 <gregoa@debian.org>  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 (file)
index 0000000..2c6b098
--- /dev/null
@@ -0,0 +1,33 @@
+Author: Johan Walles <johan.walles@gmail.com>
+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 <gregoa@debian.org>
+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 {
index 382c97c6f8b09c05cc7c7ccc8f2191bb0fdf911c..a8afbb7679686d00fcdde9f2c6990384457f3ce5 100644 (file)
@@ -1,3 +1,4 @@
 01_priority.patch
 02_segfault_longoptions.patch
 03_Makefile.patch
+04_opendir_leak.patch