From: Gianni Tedesco Subject: Re: [PATCH 1/2] xl: add cpuid parameter Date: Fri, 27 Aug 2010 15:07:35 +0100 Message-ID: <1282918055.3731.111.camel@qabil.uk.xensource.com> References: <4C77B616.30900@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C77B616.30900@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Andre Przywara Cc: xen-devel , Keir Fraser , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 2010-08-27 at 13:56 +0100, Andre Przywara wrote: > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 099d82e..da9c7fd 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -98,6 +98,20 @@ void > libxl_key_value_list_destroy(libxl_key_value_list kvl) > free(kvl); > } > > +void libxl_cpuid_destroy(libxl_cpuid_type *cpuid) > +{ > + int i, j; > + > + if (cpuid == NULL) > + return; > + for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) { > + for (j = 0; j < 4; j++) > + if (cpuid[i].policy[j] != NULL) > + free(cpuid[i].policy[j]); > + } > + free(cpuid); > +} This can be auto-generated. Also libxl_*_destroy() functions never call free on the passed pointer. Hence ending _destroy() rather than _free().