|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From aa44499da15a8fa7026463555a7a27e55e4e24a8 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Philippe De Swert <philippedeswert@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Wed, 10 Sep 2014 22:14:41 +0300
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] activate: fix fd leak in do_accept()
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Found with Coverity.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/activate/activate.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/activate/activate.c b/src/activate/activate.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 8942773866..0a1df37f35 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/activate/activate.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/activate/activate.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -242,7 +242,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int do_accept(const char* name, char **argv, char **envp, int fd) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_free_ char *local = NULL, *peer = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- int fd2;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ _cleanup_close_ int fd2 = -1;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fd2 = accept(fd, NULL, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (fd2 < 0) {
|