lib-util: Don't leak file descriptor on error.
[metze/samba/wip.git] / lib / util / become_daemon.c
index 373927ca6ea95def39716e5aae4189e54897e7b9..2ca047861f18321c4e173d901ace0e56dcb943fb 100644 (file)
@@ -62,6 +62,7 @@ _PUBLIC_ void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too)
                }
                if (fd != i) {
                        DEBUG(0,("Didn't get file descriptor %d\n",i));
+                       close(fd);
                        return;
                }
        }