From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abS7P-0002XQ-Ra for qemu-devel@nongnu.org; Thu, 03 Mar 2016 07:12:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abS7M-0006JQ-MV for qemu-devel@nongnu.org; Thu, 03 Mar 2016 07:12:35 -0500 References: <1456998223-12356-1-git-send-email-arei.gonglei@huawei.com> <1456998223-12356-3-git-send-email-arei.gonglei@huawei.com> <56D81D57.4040605@redhat.com> <33183CC9F5247A488A2544077AF19020B02EC39F@SZXEMA503-MBS.china.huawei.com> From: Paolo Bonzini Message-ID: <56D82A2C.6000607@redhat.com> Date: Thu, 3 Mar 2016 13:12:28 +0100 MIME-Version: 1.0 In-Reply-To: <33183CC9F5247A488A2544077AF19020B02EC39F@SZXEMA503-MBS.china.huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/6] sheepdog: fix possible resouce leak and out-of-bounds access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" , "qemu-devel@nongnu.org" Cc: "qemu-trivial@nongnu.org" On 03/03/2016 13:00, Gonglei (Arei) wrote: >>> > > >>> > > - ret = find_vdi_name(s, s->name, snap_id, snap_tag, &vid, true, >>> > > + ret = find_vdi_name(s, s->name, hdr.snapid, snap_tag, &vid, true, >>> > > &local_err); >>> > > if (ret) { >>> > > + error_report_err(local_err); >>> > > return ret; >>> > > } >>> > > >>> > > >> > >> > A patch for this has been posted yesterday by Jeff Cody. >> > > OK, I found it. And Max's comments is right, Jef can use hdr.snapid instead of snap_tag > to invoke find_vdi_name(). > > But, except that fix, My patch also fixed a memory leak, did you see that? No, I didn't notice -- it's not clear that error_report_err also frees the error. > Do I need post an separate patch to fix memory leak? Yes, but the right fix in my opinion is to pass errp to find_vdi_name instead. Paolo