Pidfile_Create(): Don't leak file descriptor on error path

Detected by cppcheck:
 [src/ngircd/ngircd.c:502]: (error) Resource leak: pidfd
This commit is contained in:
Alexander Barton 2012-05-22 13:29:31 +02:00
parent c9b152fa41
commit 7faa3ed7d6
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}