From: Eric Andersen Date: Wed, 5 Jun 2002 07:11:32 +0000 (-0000) Subject: plug fd leak noticed by Russ Dill X-Git-Tag: 0_60_4~176 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ff7661d9de75d0d92d76fc276b285f4138edf8c8;p=oweals%2Fbusybox.git plug fd leak noticed by Russ Dill -Erik --- diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 29e3d8673..6b090437f 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -113,6 +113,7 @@ pid_is_exec(int pid, const char *exec) sprintf(buf, "/proc/%d/cmdline", pid); fp = fopen(buf, "r"); if (fp && fgets (buf, sizeof (buf), fp) ) { + fclose(fp); if (strncmp (buf, exec, strlen(exec)) == 0) return 1; } diff --git a/init/start_stop_daemon.c b/init/start_stop_daemon.c index 29e3d8673..6b090437f 100644 --- a/init/start_stop_daemon.c +++ b/init/start_stop_daemon.c @@ -113,6 +113,7 @@ pid_is_exec(int pid, const char *exec) sprintf(buf, "/proc/%d/cmdline", pid); fp = fopen(buf, "r"); if (fp && fgets (buf, sizeof (buf), fp) ) { + fclose(fp); if (strncmp (buf, exec, strlen(exec)) == 0) return 1; }