Received: from eggs.gnu.org ([2001:4830:134:3::10]:54207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXOHx-0000nO-MT for qemu-devel@nongnu.org; Mon, 16 Mar 2015 02:14:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXOHu-0006s7-E6 for qemu-devel@nongnu.org; Mon, 16 Mar 2015 02:14:09 -0400 Date: Mon, 16 Mar 2015 14:14:02 +0800 From: Fam Zheng Message-ID: <20150316061402.GB15098@ad.nay.redhat.com> References: <1426410988-3695-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426410988-3695-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] vl: fix resource leak with monitor_fdset_add_fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-trivial@nongnu.org, zhaoshenglong@huawei.com, qemu-devel@nongnu.org, armbru@redhat.com On Sun, 03/15 10:16, Paolo Bonzini wrote: > monitor_fdset_add_fd returns an AddfdInfo struct (used by the QMP > command add_fd). Free it. > > Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng > --- > v1->v2: line length [Fam], pass &error_abort [Shannon] > v2->v3: use "!!" instead of "? true : false" [Markus] > --- > vl.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/vl.c b/vl.c > index eba5d4c..5985680 100644 > --- a/vl.c > +++ b/vl.c > @@ -1011,6 +1011,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); > @@ -1060,8 +1061,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; > } > -- > 2.3.0 > >