aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-03-15 10:16:28 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2015-03-19 11:24:44 +0300
commit636a30a890c50f734c90ee929e16492fbc6c73e3 (patch)
tree690c2ca954ffcbce0dbf322bb8f434f558e6878c /vl.c
parent3ebd6cc8d30374da8b72909960f4426e82e5f6ef (diff)
vl: fix resource leak with monitor_fdset_add_fd
monitor_fdset_add_fd returns an AddfdInfo struct (used by the QMP command add_fd). Free it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index 694deb4c1f..69617d640a 100644
--- a/vl.c
+++ b/vl.c
@@ -1012,6 +1012,7 @@ static int parse_add_fd(QemuOpts *opts, void *opaque)
int fd, dupfd, flags;
int64_t fdset_id;
const char *fd_opaque = NULL;
+ AddfdInfo *fdinfo;
fd = qemu_opt_get_number(opts, "fd", -1);
fdset_id = qemu_opt_get_number(opts, "set", -1);
@@ -1061,8 +1062,9 @@ static int parse_add_fd(QemuOpts *opts, void *opaque)
}
/* add the duplicate fd, and optionally the opaque string, to the fd set */
- monitor_fdset_add_fd(dupfd, true, fdset_id, fd_opaque ? true : false,
- fd_opaque, NULL);
+ fdinfo = monitor_fdset_add_fd(dupfd, true, fdset_id, !!fd_opaque, fd_opaque,
+ &error_abort);
+ g_free(fdinfo);
return 0;
}