From patchwork Wed Jun 3 13:08:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 49455 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 896D020BE7 for ; Wed, 3 Jun 2015 13:09:59 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf2654850lbb.0 for ; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Xd+AJICxFbNexVlQ0iRRogxzHunu+iyDxkO/p7etwIU=; b=DknH5hnWTdpAF8N3IhbCZqxLMSzcTHqIvs3SjW9kW0B9PtSm414oVXqNqpppWNVAsr /FSwCMLl56Ms2dIfeENWdqfrBcwbCqqJSh/gJtj7idgIzXqisUL9FSXJ5tA21t4lyTvE 9AhIHML8FaKI/o3l+mRlub5lcfETdcePAqweVtrehV8WoAAuYcFQKx+NzDSlR5ug5Vzc gUXbF4MTI/UiVncw8L0xHMHuq1/bVQBaTIDBHOaQgOebSX23rwUXTWk28Sr4I2oF9Pru 6DRzEqHe4L+GWnFcG865WqEKv0N8LI27MPTrbK9t5lg+0fYF52tzRcyGkcPu4zxbjq/c F+FQ== X-Gm-Message-State: ALoCoQmUC64EBoG9u7E908bJB7OCB1oVnDwzmTuYRqChbHp2RBBoXSbATmTB1lzyPO6FmVvP3VQj X-Received: by 10.180.11.101 with SMTP id p5mr21398260wib.3.1433336998517; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.36 with SMTP id ll4ls49828lac.36.gmail; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) X-Received: by 10.112.162.38 with SMTP id xx6mr22712353lbb.110.1433336998351; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id q2si4199941laq.102.2015.06.03.06.09.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2015 06:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laei3 with SMTP id i3so7581786lae.3 for ; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr31322148lag.112.1433336998226; Wed, 03 Jun 2015 06:09:58 -0700 (PDT) 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.108.230 with SMTP id hn6csp3856528lbb; Wed, 3 Jun 2015 06:09:57 -0700 (PDT) X-Received: by 10.140.232.69 with SMTP id d66mr37295879qhc.103.1433336996380; Wed, 03 Jun 2015 06:09:56 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e109si510617qgf.118.2015.06.03.06.09.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Jun 2015 06:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Qd-0000T3-7g for patch@linaro.org; Wed, 03 Jun 2015 09:09:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Ph-0007xG-0z for qemu-devel@nongnu.org; Wed, 03 Jun 2015 09:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z08Pd-0004vA-Lc for qemu-devel@nongnu.org; Wed, 03 Jun 2015 09:08:56 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:35151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Pd-0004uJ-EC; Wed, 03 Jun 2015 09:08:53 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 9B95D4079C; Wed, 3 Jun 2015 16:08:52 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 845A2A4F; Wed, 3 Jun 2015 16:08:52 +0300 (MSK) Received: (nullmailer pid 27432 invoked by uid 1000); Wed, 03 Jun 2015 13:08:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Wed, 3 Jun 2015 16:08:30 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Michael Tokarev , Shannon Zhao , Shannon Zhao Subject: [Qemu-devel] [PULL 10/30] hw/alpha/dp264.c: Fix memory leak spotted by valgrind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mjt@tls.msk.ru 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.46 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 From: Shannon Zhao valgrind complains about: ==7055== 58 bytes in 1 blocks are definitely lost in loss record 1,471 of 2,192 ==7055== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7055== by 0x24410F: malloc_and_trace (vl.c:2556) ==7055== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x64DEFD7: g_strndup (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x650181A: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x64DF0CC: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x64DF188: g_strdup_printf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x242F81: qemu_find_file (vl.c:2121) ==7055== by 0x217A32: clipper_init (dp264.c:105) ==7055== by 0x2484DA: main (vl.c:4249) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Signed-off-by: Michael Tokarev --- hw/alpha/dp264.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 9fe7e8b..f86e7bb 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -55,7 +55,7 @@ static void clipper_init(MachineState *machine) ISABus *isa_bus; qemu_irq rtc_irq; long size, i; - const char *palcode_filename; + char *palcode_filename; uint64_t palcode_entry, palcode_low, palcode_high; uint64_t kernel_entry, kernel_low, kernel_high; @@ -101,8 +101,8 @@ static void clipper_init(MachineState *machine) /* Load PALcode. Given that this is not "real" cpu palcode, but one explicitly written for the emulation, we might as well load it directly from and ELF image. */ - palcode_filename = (bios_name ? bios_name : "palcode-clipper"); - palcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, palcode_filename); + palcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, + bios_name ? bios_name : "palcode-clipper"); if (palcode_filename == NULL) { hw_error("no palcode provided\n"); exit(1); @@ -114,6 +114,7 @@ static void clipper_init(MachineState *machine) hw_error("could not load palcode '%s'\n", palcode_filename); exit(1); } + g_free(palcode_filename); /* Start all cpus at the PALcode RESET entry point. */ for (i = 0; i < smp_cpus; ++i) {