From: Ian Jackson Subject: Re: [PATCH 3/4] libxenstat: always free qmp_stats Date: Wed, 8 Apr 2015 16:49:58 +0100 Message-ID: <21797.20006.496071.588049@mariner.uk.xensource.com> References: <1428505275-6563-1-git-send-email-wei.liu2@citrix.com> <1428505275-6563-4-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1428505275-6563-4-git-send-email-wei.liu2@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: Wei Liu Cc: Charles Arnold , andrew.cooper3@citrix.com, Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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. Ian.