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

[Xen-devel] Leaks in xc_tbuf_get_size() (Was: Re: New Defects reported by Coverity Scan for XenProject)



George,

Looks like xentrace is the only maintained component which uses this. so
tag ;-)

On Tue, 2016-02-02 at 20:23 -0800, scan-admin@xxxxxxxxxxxx wrote:
> * CID 1351228:ÂÂÂ (RESOURCE_LEAK)
> /tools/libxc/xc_tbuf.c: 73 in xc_tbuf_get_size()
> /tools/libxc/xc_tbuf.c: 77 in xc_tbuf_get_size()

Coverity is reporting these as new in 41b0aa569adb..9937763265d9 although
the file hasn't changed. However it does look correct that t_info is being
leaked by various paths in this function.

> 
> 
> _________________________________________________________________________
> _______________________________
> *** CID 1351228:ÂÂÂ (RESOURCE_LEAK)
> /tools/libxc/xc_tbuf.c: 73 in xc_tbuf_get_size()
> 67ÂÂÂÂ 
> 68ÂÂÂÂÂÂÂÂ t_info = xc_map_foreign_range(xch, DOMID_XEN,
> 69ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ sysctl.u.tbuf_op.size, PROT_READ | PROT_WRITE,
> 70ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ sysctl.u.tbuf_op.buffer_mfn);
> 71ÂÂÂÂ 
> 72ÂÂÂÂÂÂÂÂ if ( t_info == NULL || t_info->tbuf_size == 0 )
> >>>ÂÂÂÂ CID 1351228:ÂÂÂ (RESOURCE_LEAK)
> >>>ÂÂÂÂ Variable "t_info" going out of scope leaks the storage it points
> to.
> 73ÂÂÂÂÂÂÂÂÂÂÂÂ return -1;
> 74ÂÂÂÂ 
> 75ÂÂÂÂÂÂÂÂ *size = t_info->tbuf_size;
> 76ÂÂÂÂ 
> 77ÂÂÂÂÂÂÂÂ return 0;
> 78ÂÂÂÂ }
> /tools/libxc/xc_tbuf.c: 77 in xc_tbuf_get_size()
> 71ÂÂÂÂ 
> 72ÂÂÂÂÂÂÂÂ if ( t_info == NULL || t_info->tbuf_size == 0 )
> 73ÂÂÂÂÂÂÂÂÂÂÂÂ return -1;
> 74ÂÂÂÂ 
> 75ÂÂÂÂÂÂÂÂ *size = t_info->tbuf_size;
> 76ÂÂÂÂ 
> >>>ÂÂÂÂ CID 1351228:ÂÂÂ (RESOURCE_LEAK)
> >>>ÂÂÂÂ Variable "t_info" going out of scope leaks the storage it points
> to.
> 77ÂÂÂÂÂÂÂÂ return 0;
> 78ÂÂÂÂ }
> 79ÂÂÂÂ 
> 80ÂÂÂÂ int xc_tbuf_enable(xc_interface *xch, unsigned long pages,
> unsigned long *mfn,
> 81ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ unsigned long *size)
> 82ÂÂÂÂ {
_______________________________________________
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®.