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 7607157..e13b12d 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 382c97c..a8afbb7 100644 (file)
@@ -1,3 +1,4 @@
 01_priority.patch
 02_segfault_longoptions.patch
 03_Makefile.patch
+04_opendir_leak.patch