When fork fails, we return without closing the socket pair that was just created. This might cause file descriptor leaks.
Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@canonical.com> --- nbd-server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nbd-server.c b/nbd-server.c index f5b244f..c2e20c2 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -2807,6 +2807,8 @@ spawn_child(int* socket) pid = fork(); if (pid < 0) { msg(LOG_ERR, "Could not fork (%s)", strerror(errno)); + close(sockets[0]); + close(sockets[1]); goto out; } if (pid > 0) { /* Parent */ -- 2.17.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Nbd-general mailing list Nbd-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nbd-general