From: Ian Campbell Subject: Re: [PATCH for-4.6 v3] libxlu: properly free buffer in PCI related functions Date: Wed, 29 Jul 2015 16:04:46 +0100 Message-ID: <1438182286.11600.209.camel@citrix.com> References: <1438100636-2517-1-git-send-email-wei.liu2@citrix.com> <1438100636-2517-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZKSvI-0006Dc-Ve for xen-devel@lists.xenproject.org; Wed, 29 Jul 2015 15:05:37 +0000 In-Reply-To: <1438100636-2517-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , Xen-devel Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org On Tue, 2015-07-28 at 17:23 +0100, Wei Liu wrote: > Free buffer in both success and failure paths. > > Signed-off-by: Wei Liu Acked + applied. > --- > tools/libxl/libxlu_pci.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c > index 026413b..2cd793d 100644 > --- a/tools/libxl/libxlu_pci.c > +++ b/tools/libxl/libxlu_pci.c > @@ -167,17 +167,18 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, > libxl_device_pci *pcidev, const char *str > } > } > > - free(buf2); > - > if ( tok != ptr || state != STATE_TERMINAL ) > goto parse_error; > > /* Just a pretty way to fill in the values */ > pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3); > > + free(buf2); > + > return 0; > > parse_error: > + free(buf2); > return ERROR_INVAL; > } > > @@ -246,14 +247,15 @@ int xlu_rdm_parse(XLU_Config *cfg, > libxl_rdm_reserve *rdm, const char *str) > } > } > > - free(buf2); > - > if (tok != ptr || state != STATE_TERMINAL) > goto parse_error; > > + free(buf2); > + > return 0; > > parse_error: > + free(buf2); > return ERROR_INVAL; > } >