diff options
author | Bill Nottingham <notting@redhat.com> | 2005-03-31 21:39:24 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2005-03-31 21:39:24 +0000 |
commit | 170aa264f196111dd4a644fe81f08a300566bcd1 (patch) | |
tree | 0cc303f341a99a6d9541dba0048164cb0b14dc30 /src/process.c | |
parent | 44e946f166e0638cbeff106244b69d18707e1784 (diff) | |
download | initscripts-170aa264f196111dd4a644fe81f08a300566bcd1.tar initscripts-170aa264f196111dd4a644fe81f08a300566bcd1.tar.gz initscripts-170aa264f196111dd4a644fe81f08a300566bcd1.tar.bz2 initscripts-170aa264f196111dd4a644fe81f08a300566bcd1.tar.xz initscripts-170aa264f196111dd4a644fe81f08a300566bcd1.zip |
free some of the more egregious memory leaks (#85935)
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index c17680bf..0eec34ac 100644 --- a/src/process.c +++ b/src/process.c @@ -188,7 +188,8 @@ int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet, int bytesread = 0; do { - char *buf=calloc(8192,sizeof(char)); + char *b, *buf=calloc(8192,sizeof(char)); + b = buf; bytesread = read(pfds[y].fd,buf,8192); if (bytesread==-1) { perror("read"); @@ -251,11 +252,16 @@ int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet, } cmdargs[cmdargc+1]=NULL; processArgs(cmdargc+1,cmdargs,1); + for (z=0;z<(cmdargc);z++) { + free(cmdargs[z]); + } + free(cmdargs); } } + if (tmpstr) free(tmpstr); } } - free(buf); + free(b); } while ( bytesread==8192 ); } y++; |