From patchwork Thu May 28 12:39:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49099 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 04EFA218EC for ; Thu, 28 May 2015 12:46:18 +0000 (UTC) Received: by wizk4 with SMTP id k4sf13551582wiz.2 for ; Thu, 28 May 2015 05:46:17 -0700 (PDT) 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:in-reply-to :references:mime-version:content-type: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=SLvfITLbt6/qiCEJ4xSz4fyicvx4OBqh2EjtR/2Q7/A=; b=giI9CxegT1LvyFYDF84PBAf0iRG5hwfDrmObW9FUqjWNtwUZtROYwyV5rynSqdOWwq ZXvMuNDdGSDxBLJn9uwnpQ/wFA/dephLNG0lh+dGPMUzoseYDpu+WdlGGBdo8RMrRzbc 0S+RS/Zav7SXB+39Xo22Ru2qd6HmnZFDFSG7G/qwTq6ud2TQpoZgQuxKAubt2dhVEhoK qVD5npAvCum44enP3Qci3gy5svZAZUUhHXPqkBatP7BSdVju147C2Ulscpokq6SYna8A O6fMZGxBGD0ZINwjQeBl3zTWkbKtqxQo+BtmpgAR/Lhf5ubObRU7EG4uH1oAJpWmu2/R bIsg== X-Gm-Message-State: ALoCoQllWMh/4M1yU8S4Gauouvpert6bAozOhvJbkxh5YnJthbIDmMmWtcjLxJqBmbF/sFxgtsZ4 X-Received: by 10.152.206.36 with SMTP id ll4mr2568900lac.6.1432817177271; Thu, 28 May 2015 05:46:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.73 with SMTP id i9ls193604lai.100.gmail; Thu, 28 May 2015 05:46:17 -0700 (PDT) X-Received: by 10.112.157.36 with SMTP id wj4mr2548301lbb.115.1432817177092; Thu, 28 May 2015 05:46:17 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id i6si1882481lai.30.2015.05.28.05.46.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labko7 with SMTP id ko7so27102443lab.2 for ; Thu, 28 May 2015 05:46:16 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr2645087lbb.36.1432817176649; Thu, 28 May 2015 05:46:16 -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 hn6csp1130026lbb; Thu, 28 May 2015 05:46:15 -0700 (PDT) X-Received: by 10.140.81.135 with SMTP id f7mr2867431qgd.33.1432817175392; Thu, 28 May 2015 05:46:15 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d191si2238279qka.74.2015.05.28.05.46.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 05:46:15 -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]:58757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxxCQ-0000UE-Fe for patch@linaro.org; Thu, 28 May 2015 08:46:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxx6t-0007hn-3Z for qemu-devel@nongnu.org; Thu, 28 May 2015 08:40:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yxx6k-0007sX-OD for qemu-devel@nongnu.org; Thu, 28 May 2015 08:40:31 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:57977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxx6k-0007iU-24; Thu, 28 May 2015 08:40:22 -0400 Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id COQ01166; Thu, 28 May 2015 20:40:08 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Thu, 28 May 2015 20:39:59 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 20:39:44 +0800 Message-ID: <1432816784-12436-5-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432816784-12436-1-git-send-email-zhaoshenglong@huawei.com> References: <1432816784-12436-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mjt@tls.msk.ru, shannon.zhao@linaro.org, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH v2 4/4] hw/display/tcx.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: patch@linaro.org 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.50 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: ==23693== 55 bytes in 1 blocks are definitely lost in loss record 1,277 of 2,014 ==23693== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==23693== by 0x21B93F: malloc_and_trace (vl.c:2556) ==23693== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==23693== by 0x64DEFD7: g_strndup (in /usr/lib64/libglib-2.0.so.0.3600.3) ==23693== by 0x650181A: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==23693== by 0x64DF0CC: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==23693== by 0x64DF188: g_strdup_printf (in /usr/lib64/libglib-2.0.so.0.3600.3) ==23693== by 0x21A7B1: qemu_find_file (vl.c:2121) ==23693== by 0x1E4F6E: tcx_realizefn (tcx.c:1013) ==23693== by 0x26CC20: device_set_realized (qdev.c:1058) ==23693== by 0x2B6766: property_set_bool (object.c:1514) ==23693== by 0x2B5060: object_property_set (object.c:837) Signed-off-by: Shannon Zhao --- hw/display/tcx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index a9f9f66..ec0aa0d 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -1015,8 +1015,9 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) ret = load_image_targphys(fcode_filename, s->prom_addr, FCODE_MAX_ROM_SIZE); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { - error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); + error_report("tcx: could not load prom '%s'", fcode_filename); } + g_free(fcode_filename); } /* 0/DFB8 : 8-bit plane */