Module: ngircd.git Branch: master Commit: 7faa3ed7d6613f23e998604461f543e763278f7e URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=7faa3...
Author: Alexander Barton alex@barton.de Date: Tue May 22 13:29:31 2012 +0200
Pidfile_Create(): Don't leak file descriptor on error path
Detected by cppcheck: [src/ngircd/ngircd.c:502]: (error) Resource leak: pidfd
---
src/ngircd/ngircd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c index f28ff05..8a93bcb 100644 --- a/src/ngircd/ngircd.c +++ b/src/ngircd/ngircd.c @@ -498,7 +498,8 @@ Pidfile_Create(pid_t pid)
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid); if (len < 0 || len >= (int)sizeof pidbuf) { - Log( LOG_ERR, "Error converting pid"); + Log(LOG_ERR, "Error converting pid"); + close(pidfd); return; }