From: Ian Campbell Subject: Re: [Patch v3 3/4] tools/libxl: Fix libxl__device_nic_from_xs_be() Date: Wed, 18 Dec 2013 11:10:37 +0000 Message-ID: <1387365037.27441.110.camel@kazak.uk.xensource.com> References: <52939C67.7020108@citrix.com> <1385412567-7717-1-git-send-email-andrew.cooper3@citrix.com> <21140.34516.685325.920576@mariner.uk.xensource.com> <5294892B.5030003@citrix.com> <21140.36721.61987.750679@mariner.uk.xensource.com> <5294A8F8.8090706@citrix.com> <21140.47494.337790.858352@mariner.uk.xensource.com> <5294BAFE.6070707@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5294BAFE.6070707@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: Roger Pau Monne , Ian Jackson , Xen-devel List-Id: xen-devel@lists.xenproject.org On Tue, 2013-11-26 at 15:15 +0000, Andrew Cooper wrote: > On 26/11/13 15:08, Ian Jackson wrote: > > Andrew Cooper writes ("Re: [Xen-devel] [Patch v3 3/4] tools/libxl: Fix libxl__device_nic_from_xs_be()"): > >> Commit message should include the Coverity ID 1055886, and perhaps a > >> reference to the fact that it is a memory leak. > > ... > >>> + nic->ip = READ_BACKEND("ip"); > >>> + nic->bridge = READ_BACKEND("bridge"); > >>> + nic->script = READ_BACKEND("script"); > >> This is not correct. libxl_device_nic_dispose() is in charge of freeing > >> these pointers, but now they are part of the gc. > > Oops. > > > > From 5bdaef8453bc8fd06da956df90fe33a12190342c Mon Sep 17 00:00:00 2001 > > From: Ian Jackson > > Date: Tue, 26 Nov 2013 12:08:09 +0000 > > Subject: [PATCH] libxl: Fix error handling in libxl__device_nic_from_xs_be > > > > Previously, this function had a memory leak. Fix this, and the rest > > of the error handling. I had to go back to the original to figure out what the memory leak was, and so I rewrote this as: Previously, this function would leak the temporary return from xs_read for handle and mac address. Fix both of these and the rest of the error handling. > > > > This requires changing its return type and fixing the callers. > > > > Introduce here a READ_BACKEND macro to make the code less repetitive. > > > > Coverity ID: 1055886 > > > > Signed-off-by: Ian Jackson > > This looks like it might plausibly work. > > Reviewed-by: Andrew Cooper Acked + committed with the above. Ian.