* New upstream maintainer and location:
[debian/cpulimit.git] / debian / patches / 04_opendir_leak.patch
1 Author: Johan Walles <johan.walles@gmail.com>
2 Bug-Debian: http://bugs.debian.org/564517
3 Description: Each time cpulimit finds a process to limit, it does a goto
4  past the call to closedir(). Plug that leak.
5 Forwarded: yes
6 Origin: vendor, cf. bug
7 Reviewed-By: gregor herrmann <gregoa@debian.org>
8 Last-Update: 2010-01-11
9
10 --- a/cpulimit.c
11 +++ b/cpulimit.c
12 @@ -98,6 +98,10 @@
13                                 //pid detected
14                                 if (kill(pid,SIGSTOP)==0 &&  kill(pid,SIGCONT)==0) {
15                                         //process is ok!
16 +                                       if (closedir(dip) == -1) {
17 +                                               perror("closedir");
18 +                                               return -1;
19 +                                       }
20                                         goto done;
21                                 }
22                                 else {
23 @@ -188,6 +192,10 @@
24                                         if (found==1) {
25                                                 if (kill(pid,SIGSTOP)==0 &&  kill(pid,SIGCONT)==0) {
26                                                         //process is ok!
27 +                                                       if (closedir(dip) == -1) {
28 +                                                               perror("closedir");
29 +                                                               return -1;
30 +                                                       }
31                                                         goto done;
32                                                 }
33                                                 else {