[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.6 v2 6/8] libxlu: free buffer in failure path for PCI related functions



On Mon, 2015-07-27 at 18:45 +0100, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  tools/libxl/libxlu_pci.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
> index 026413b..16ddaf7 100644
> --- a/tools/libxl/libxlu_pci.c
> +++ b/tools/libxl/libxlu_pci.c
> @@ -178,6 +178,7 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, 
> libxl_device_pci *pcidev, const char *str
>      return 0;
>  
>  parse_error:
> +    free(buf2);

There is a path (half a dozen lines above) which can do free(buf2) followed
by goto parse_error. That free ought to set buf2=NULL, or the free needs to
move after that check on the success path.


>      return ERROR_INVAL;
>  }
>  
> @@ -254,6 +255,7 @@ int xlu_rdm_parse(XLU_Config *cfg, libxl_rdm_reserve 
> *rdm, const char *str)
>      return 0;
>  
>  parse_error:
> +    free(buf2);

Same here.

>      return ERROR_INVAL;
>  }
>  

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.