From: Philippe De Swert Date: Wed, 10 Sep 2014 19:14:41 +0000 (+0300) Subject: activate: fix fd leak in do_accept() X-Git-Tag: v217~593 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=aa44499da15a8fa7026463555a7a27e55e4e24a8;ds=sidebyside activate: fix fd leak in do_accept() Found with Coverity. --- diff --git a/src/activate/activate.c b/src/activate/activate.c index 894277386..0a1df37f3 100644 --- a/src/activate/activate.c +++ b/src/activate/activate.c @@ -242,7 +242,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) { static int do_accept(const char* name, char **argv, char **envp, int fd) { _cleanup_free_ char *local = NULL, *peer = NULL; - int fd2; + _cleanup_close_ int fd2 = -1; fd2 = accept(fd, NULL, NULL); if (fd2 < 0) {