From: Wei Liu Subject: Re: libxl memory leaks when Xen is compiled with XSM Date: Mon, 29 Dec 2014 13:28:21 +0000 Message-ID: <20141229132821.GB12240@zion.uk.xensource.com> References: <549436A8.1020303@citrix.com> <54943B75.4090703@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <54943B75.4090703@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: Andrew Cooper Cc: Wei Liu , Ian Jackson , Ian Campbell , Xen-devel List List-Id: xen-devel@lists.xenproject.org On Fri, Dec 19, 2014 at 02:51:33PM +0000, Andrew Cooper wrote: > Correctly CC'ing xen-devel as well this time > > ~Andrew > > On 19/12/14 14:31, Andrew Cooper wrote: > > Hello, > > > > Coverity has identified a large number of memory leaks in libxl, because > > of the use of libxl_domain_info() without an init/dispose for the > > libxl_dominfo object. > > > > If XSM is active, this leaks the ssid_label string, and in almost all > > cases, from the successful completion of the library function in question. > > > > Most of the issues can be fixed with the correct use of > > init()/dispose(), but libxl_wait_for_memory_target() is a little more > > interesting. > > > > Strictly speaking, I think I would need to fix it with a > > dispose();init() pair immediately before the call to > > libxl_domain_info(). However, this feels like overkill. As only the > > memory information is needed, would it be appropriate to downgrade to an > > xc_domain_getinfo() instead, forgoing the memory allocation and > > extraneous hypercalls? > > As long as caller visible behaviour is not changed I think it's OK to do so. Wei. > > ~Andrew > >