From: Ian Jackson Subject: Re: [PATCH RFC V2 05/10] libxl_json: introduce parser functions for builtin types Date: Thu, 24 Apr 2014 16:29:28 +0100 Message-ID: <21337.11736.844619.971839@mariner.uk.xensource.com> References: <1397733191-31892-1-git-send-email-wei.liu2@citrix.com> <1397733191-31892-6-git-send-email-wei.liu2@citrix.com> <1398179398.4880.51.camel@kazak.uk.xensource.com> <20140423100134.GX7712@zion.uk.xensource.com> <20140423152007.GF7712@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140423152007.GF7712@zion.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: Wei Liu Cc: Anthony Perard , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("Re: [PATCH RFC V2 05/10] libxl_json: introduce parser functions for builtin types"): > I was wrong about this. > > This (and other allocations alike) should use calloc instead of GC > allocation. We don't want GC to free the memory until dispose is called. Instead of calloc, you should use libxl__zalloc(NOGC,...). That has the right error handling (and you don't need to check for errors yourself). Ian.