From patchwork Thu Nov 6 13:00:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 40282 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D345A20C4E for ; Thu, 6 Nov 2014 13:02:50 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf646164lbj.3 for ; Thu, 06 Nov 2014 05:02:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=IgZ3WYjLNcghzkxq1T/WfkzpDrHHjfWDcdxLk0SFRss=; b=TEOXdwn5K+BzktJ25b/u4RrRVScbFx+Ai7YnSiOcvka5iSxRiQHEMe1OY+O9b1ot79 8CFwTRtil+REcD5PDVu0UGS4U9OnOhyrK35Iwa7R6tdQVUWuNhqnm9Da/bx4Cj3F+wtf 89S3HSbH7lc0L3SArjXOEHT5UpVkcrFg0s8/UwFeGBgmPF2BFQZKvVbopbvrjQObxBCc UuQIqCGhJt0XuqwQ2S3C3gpAcx/7Caa+P4Re4KWqlyPwqvUAa26tPVIGFdph4+tnumHL yrOweEkHhRbi06NgBRYY88zlC7pxvA7fMf2AdtgD507eAlHRtCK9NtVrNSnRhUPIUOht CfdQ== X-Gm-Message-State: ALoCoQmnzqBjWdKl6PC+HowK7oHYObaSN7aKLLj9b3jnm+yL9/FdeJk9+CKktbl/K+RK0bpS2jq8 X-Received: by 10.180.98.165 with SMTP id ej5mr596134wib.1.1415278969817; Thu, 06 Nov 2014 05:02:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.169 with SMTP id c9ls71474laa.104.gmail; Thu, 06 Nov 2014 05:02:49 -0800 (PST) X-Received: by 10.112.150.136 with SMTP id ui8mr4999094lbb.60.1415278969313; Thu, 06 Nov 2014 05:02:49 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id i3si11416060lae.59.2014.11.06.05.02.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 05:02:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id ge10so2510503lab.22 for ; Thu, 06 Nov 2014 05:02:49 -0800 (PST) X-Received: by 10.112.130.41 with SMTP id ob9mr4879675lbb.74.1415278969221; Thu, 06 Nov 2014 05:02:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp39922lbc; Thu, 6 Nov 2014 05:02:48 -0800 (PST) X-Received: by 10.52.22.129 with SMTP id d1mr2358488vdf.19.1415278968031; Thu, 06 Nov 2014 05:02:48 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id cv7si4887570vcb.2.2014.11.06.05.02.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 05:02:48 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XmMgR-0007Af-RC; Thu, 06 Nov 2014 13:01:03 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XmMgQ-0007AZ-9n for xen-devel@lists.xen.org; Thu, 06 Nov 2014 13:01:02 +0000 Received: from [85.158.137.68] by server-10.bemta-3.messagelabs.com id 97/07-24859-D017B545; Thu, 06 Nov 2014 13:01:01 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1415278859!10801510!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21221 invoked from network); 6 Nov 2014 13:01:00 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 6 Nov 2014 13:01:00 -0000 X-IronPort-AV: E=Sophos;i="5.07,325,1413244800"; d="scan'208";a="190150222" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Thu, 6 Nov 2014 08:00:33 -0500 Received: from cosworth.uk.xensource.com ([10.80.16.52] helo=localhost.localdomain ident=ianc) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XmMfw-0006tc-21; Thu, 06 Nov 2014 13:00:33 +0000 Received: by localhost.localdomain (sSMTP sendmail emulation); Thu, 06 Nov 2014 13:00:31 +0000 From: Ian Campbell To: , , Date: Thu, 6 Nov 2014 13:00:31 +0000 Message-ID: <1415278831-9249-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell Subject: [Xen-devel] [PATCH] tools: libxl: do not leak diskpath during local disk attach X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: libxl__device_disk_local_initiate_attach is assigning dls->diskpath with a strdup of the device path. This is then passed to the callback, e.g. parse_bootloader_result but bootloader_cleanup will not free it. Since the callback is within the scope of the (e)gc and therefore doesn't need to be malloc'd, a gc'd alloc will do. All other assignments to this field use the gc. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767295 Reported-by: Gedalya Signed-off-by: Ian Campbell Acked-by: Wei Liu Acked-by: Ian Jackson --- This is a bug fix for 4.5. This fix should be queued for backporting to at least 4.4 --- tools/libxl/libxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 18561fb..e76d898 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -3030,7 +3030,7 @@ void libxl__device_disk_local_initiate_attach(libxl__egc *egc, } if (dev != NULL) - dls->diskpath = strdup(dev); + dls->diskpath = libxl__strdup(gc, dev); dls->callback(egc, dls, 0); return;