From: Wei Liu Subject: Re: [PATCH 3/4] libxenstat: always free qmp_stats Date: Wed, 8 Apr 2015 16:56:18 +0100 Message-ID: <20150408155618.GM30811@zion.uk.xensource.com> References: <1428505275-6563-1-git-send-email-wei.liu2@citrix.com> <1428505275-6563-4-git-send-email-wei.liu2@citrix.com> <21797.20006.496071.588049@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <21797.20006.496071.588049@mariner.uk.xensource.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: Ian Jackson Cc: Charles Arnold , andrew.cooper3@citrix.com, Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Apr 08, 2015 at 04:49:58PM +0100, Ian Jackson wrote: > Wei Liu writes ("[PATCH 3/4] libxenstat: always free qmp_stats"): > > Originally qmp_stats is only freed in failure path and leaked in success > > path. > > > > Instead of wiring up the success path, rearrange the code a bit to > > always free qmp_stats before checking if info is NULL. > > Acked-by: Ian Jackson > > Having said that, I am not a great fan of the error handling cleanup > style adopted in this code in general. The ownership and lifetime of > the various allocated objects has to be inferred by reading the code > in detail. > Yeah... I'm with you. On the other hand I want my bug fix patch to be as small as possible. Changing this function to goto style will make the patch a lot bigger. I think we can clean this function up with another patch if anyone feels keen enough. Wei. > Ian.