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:
parent
c9b152fa41
commit
7faa3ed7d6
|
@ -498,7 +498,8 @@ Pidfile_Create(pid_t pid)
|
||||||
|
|
||||||
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
|
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
|
||||||
if (len < 0 || len >= (int)sizeof pidbuf) {
|
if (len < 0 || len >= (int)sizeof pidbuf) {
|
||||||
Log( LOG_ERR, "Error converting pid");
|
Log(LOG_ERR, "Error converting pid");
|
||||||
|
close(pidfd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue