[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
- [Qemu-devel] [PULL 00/16] QMP queue, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 05/16] error: Print error_report() to stderr if using qmp, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 14/16] HMP: fix doc of dump-guest-memory, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 06/16] qerror.h: Remove unused error classes, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 07/16] qerror.h: Remove QERR defines that are only used once, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 15/16] HMP: support specifying dump format for dump-guest-memory, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 16/16] monitor: fix qmp_getfd() fd leak in error case,
Luiz Capitulino <=
- [Qemu-devel] [PULL 13/16] qmp: object-add: Validate class before creating object, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 08/16] qerror.h: Replace QERR_NOT_SUPPORTED with QERR_UNSUPPORTED, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 09/16] error: Remove some unused headers, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 12/16] monitor: Add device_add and device_del completion., Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 11/16] monitor: Add command_completion callback to mon_cmd_t., Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 02/16] vnc: Remove default_mon usage, Luiz Capitulino, 2014/04/25
- [Qemu-devel] [PULL 10/16] monitor: Fix drive_del id argument type completion., Luiz Capitulino, 2014/04/25
- Re: [Qemu-devel] [PULL 00/16] QMP queue, Peter Maydell, 2014/04/28