From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP5q-0002xh-4p for qemu-devel@nongnu.org; Fri, 13 Mar 2015 08:53:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP5p-0001m1-Ff for qemu-devel@nongnu.org; Fri, 13 Mar 2015 08:53:34 -0400 Message-ID: <5502DDBB.8070002@redhat.com> Date: Fri, 13 Mar 2015 13:53:15 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1426172243-7830-1-git-send-email-pbonzini@redhat.com> <550272F4.30309@huawei.com> In-Reply-To: <550272F4.30309@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl: fix resource leak with monitor_fdset_add_fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Hangaohuai , "Gonglei (Arei)" , "Huangpeng (Peter)" On 13/03/2015 06:17, Shannon Zhao wrote: >> > - 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 ? true : false, >> > + fd_opaque, NULL); >> > + g_free(fdinfo); >> > >> > return 0; >> > } >> > > Hi Paolo, > > Not about the resource leak, but I think we should check fdinfo == NULL and return -1. > Then when error occurs, qemu will exit. Besides we should pass a meaningful errp not NULL. > So qemu can report the error reason. Right? It cannot fail here, so another possibility could be to pass &error_abort. Paolo