From: Ian Campbell Subject: Re: [PATCH] xl: free default_{vifscript, bridge, gatewaydev} on exit Date: Wed, 12 Jun 2013 14:08:15 +0100 Message-ID: <1371042495.24512.426.camel@zakaz.uk.xensource.com> References: <1371040718-11400-1-git-send-email-ian.campbell@citrix.com> <20920.27766.783652.663282@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20920.27766.783652.663282@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: George.Dunlap@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2013-06-12 at 13:41 +0100, Ian Jackson wrote: > Ian Campbell writes ("[PATCH] xl: free default_{vifscript,bridge,gatewaydev} on exit"): > > These leaks aren't serious, since they are only in xl but this makes "xl list" > > clean according to valgrind, which is useful from the point of view of > > eliminating false positives when looking at the state of libxl (where leaks > > matter). > ... > > + if (default_vifscript) { > > + free(default_vifscript); > > + default_vifscript = NULL; > > These ifs are unnecessary. free(NULL) is a no-op. > > I would write: > > + free(default_vifscript); default_vifscript = NULL; > + free(default_bridge); default_bridge = NULL; > + free(default_gatewaydev); default_gatewaydev = NULL; > > which is nice and regular. So would I except this is the prevailing style in that function for some reason (even though I have a feeling I wrote it). Ian.