Skip to content

Commit f4672ed

Browse files
committed
Fix leaked socket descriptor in wdctl_thread
1 parent 0a9a10c commit f4672ed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/wdctl_thread.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,13 @@ wdctl_restart(int afd)
306306
/* Which to use, AF_UNIX, PF_UNIX, AF_LOCAL, PF_LOCAL? */
307307
if (bind(sock, (struct sockaddr *)&sa_un, strlen(sock_name) + sizeof(sa_un.sun_family))) {
308308
debug(LOG_ERR, "Could not bind internal socket: %s", strerror(errno));
309+
close(sock);
309310
return;
310311
}
311312

312313
if (listen(sock, 5)) {
313314
debug(LOG_ERR, "Could not listen on internal socket: %s", strerror(errno));
315+
close(sock);
314316
return;
315317
}
316318

0 commit comments

Comments
 (0)