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

Re: [Xen-devel] [PATCH] libxc: Fix CID 1351228 resource leak



On Wed, 2016-02-10 at 14:39 +0530, Harmandeep Kaur wrote:
>
What I just said about the other patch ("libxc: Fix CID 1351225
resource leak") applies here as well, of course. :-)

About the code...

> --- a/tools/libxc/xc_tbuf.c
> +++ b/tools/libxc/xc_tbuf.c
> @@ -70,9 +70,13 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned
> long *size)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsysctl.u.tbuf_op.buffer_mfn);
> Â
> ÂÂÂÂÂif ( t_info == NULL || t_info->tbuf_size == 0 )
> +ÂÂÂÂ{
> +ÂÂÂÂÂÂÂÂxenforeignmemory_unmap(xch->fmem, t_info, 0);
> ÂÂÂÂÂÂÂÂÂreturn -1;
> +ÂÂÂÂ}
> Â
> ÂÂÂÂÂ*size = t_info->tbuf_size;
> +ÂÂÂÂxenforeignmemory_unmap(xch->fmem, t_info, *size);
> Â
I think you can arrange for only calling the unmapping function once,
i.e., put the unmap call in a place where (after a slight
reorganization of the rest of the code as well) it can be common to
both the success and error path.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
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®.