qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 16/16] monitor: fix qmp_getfd() fd leak in error case


From: Luiz Capitulino
Subject: [Qemu-devel] [PULL 16/16] monitor: fix qmp_getfd() fd leak in error case
Date: Fri, 25 Apr 2014 14:29:47 -0400

From: Stefan Hajnoczi <address@hidden>

qemu_chr_fe_get_msgfd() transfers ownership of the file descriptor to
the caller.  Therefore all code paths in qmp_getfd() should either
register the file descriptor somewhere or close it.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/monitor.c b/monitor.c
index 9ad8578..1266ba0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2228,6 +2228,7 @@ void qmp_getfd(const char *fdname, Error **errp)
     }
 
     if (qemu_isdigit(fdname[0])) {
+        close(fd);
         error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
                   "a name not starting with a digit");
         return;
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]