From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v1 4/4] libxl: info: Display build_id of the hypervisor. Date: Fri, 9 Oct 2015 14:11:24 +0100 Message-ID: <5617BCFC.4020602@citrix.com> References: <1444359390-14153-1-git-send-email-konrad.wilk@oracle.com> <1444359390-14153-5-git-send-email-konrad.wilk@oracle.com> <5617BA3C.3020008@citrix.com> <1444395971.1410.385.camel@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 1ZkXSL-0008Rw-3d for xen-devel@lists.xenproject.org; Fri, 09 Oct 2015 13:11:29 +0000 In-Reply-To: <1444395971.1410.385.camel@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: Ian Campbell , Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, mpohlack@amazon.de, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org On 09/10/15 14:06, Ian Campbell wrote: > On Fri, 2015-10-09 at 13:59 +0100, Andrew Cooper wrote: >> On 09/10/15 03:56, Konrad Rzeszutek Wilk wrote: >>> + rc = xc_version_len(ctx->xch, XENVER_build_id, &u.build_id, >>> BUILD_ID_LEN); >>> + if (rc > 0) { >>> + unsigned int i; >>> + >>> + info->build_id = (char *)malloc((rc * 2) + 1); >>> + >>> + for (i = 0; i < rc && (i + 1) * 2 < BUILD_ID_LEN; i++) >>> + snprintf(&info->build_id[i * 2], 3, "%02hhx", >>> u.build_id[i]); >>> + >>> + info->build_id[i*2]='\0'; >>> + } else >>> + info->build_id = strdup(""); >> info->build_id is unconditionally leaked, given this patch. > It should be freed by libxl_version_info_dispose, which any correct callers > should already be using. Ah - so it will. Sorry for the noise. ~Andrew