From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 1/4] libxl: Use libxl_strdup instead of strdup on libxl_version_info Date: Wed, 3 Feb 2016 11:46:41 +0000 Message-ID: <1454500001.25207.81.camel@citrix.com> References: <1453843860-29591-1-git-send-email-konrad.wilk@oracle.com> <1453843860-29591-2-git-send-email-konrad.wilk@oracle.com> <20160201121359.GV25660@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQvtW-0002JX-J4 for xen-devel@lists.xenproject.org; Wed, 03 Feb 2016 11:46:46 +0000 In-Reply-To: <20160201121359.GV25660@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 , Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, Ian.Jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, 2016-02-01 at 12:13 +0000, Wei Liu wrote: > On Tue, Jan 26, 2016 at 04:30:57PM -0500, Konrad Rzeszutek Wilk wrote: > > The change is simple replace of raw strdup with a libxl variant. > > The benefit of that is the libxl variant has the extra > > behaviour of abort-on-alloc-fail - and will improve error handling. > > > > libxl_version_info is a bit odd - it is a public function and as > > libxl.h > > mentions - the callers of libxl_ public function needs to call the > > appropiate > > _dispose() function. > > > > "However libxl_get_version_info() is special and returns a cached > > result from the ctx which cannot and should not be freed (as evidenced > > by it returning a const struct). This data is freed in libxl_ctx_free() > > by calling libxl_version_info_dispose(). This is why none of the > > callers > > remember to free -- they shouldn't be doing so." (Ian Campbell) > > > > So the patch makes sure to use the NOGC. > > > > Suggested-by: Wei Liu > > Signed-off-by: Konrad Rzeszutek Wilk > > Acked-by: Wei Liu Applied.