From patchwork Thu May 28 11:13:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49058 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1350F218EC for ; Thu, 28 May 2015 11:18:11 +0000 (UTC) Received: by lagv1 with SMTP id v1sf10160382lag.1 for ; Thu, 28 May 2015 04:18:10 -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=lk3OykUIQ06Tz2LsfTFa6bWai38RLxTS5vRX4TFErOg=; b=IylgP4s/YlVDNGsxyYUxaghSzvewyDfsJxFdaUtQz3/8IFvx4iUGHciEdBKfQinffk D05d6hBThm2KqurNsGDdfNpnOrHWRe3Nefn2M2HtDWs9i8yICdFpR5qgSv0ibYfd2s0p OBO1hXl2akTG4cFC7fhJMSjIgYtoFf98fH9CyBHKXucgFicGwgWo8ScUXI2BEUByvLnY Cbx0rcvpN0OWId9NZm0rhhiaZydd4BavTKQIyc8Jd80hhEspq2e7eE/atTsdVzdqrU8B pjPt5rkmoQbTtEeCppmMMHdUu4jj5Y2BIQSulcrj64o27B6/xhoSbWGz7zZbOpugncTK T19w== X-Gm-Message-State: ALoCoQnAwdFhTQhlOSuphQ9KuXNOebPZU+oANDTEz1cfATgeE046taSTR0BXgKJNDQgu4raOeef8 X-Received: by 10.112.142.170 with SMTP id rx10mr2227037lbb.12.1432811890037; Thu, 28 May 2015 04:18:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.7 with SMTP id js7ls162131lab.34.gmail; Thu, 28 May 2015 04:18:09 -0700 (PDT) X-Received: by 10.112.161.40 with SMTP id xp8mr2181433lbb.71.1432811889922; Thu, 28 May 2015 04:18:09 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id r6si1671830lag.118.2015.05.28.04.18.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 04:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbuc2 with SMTP id uc2so25874510lbb.2 for ; Thu, 28 May 2015 04:18:09 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr2223723lah.76.1432811889837; Thu, 28 May 2015 04:18:09 -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 hn6csp1070947lbb; Thu, 28 May 2015 04:18:08 -0700 (PDT) X-Received: by 10.140.237.68 with SMTP id i65mr2567130qhc.42.1432811887529; Thu, 28 May 2015 04:18:07 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 67si2034754qgm.49.2015.05.28.04.18.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 04:18:07 -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]:57750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxvp8-0000mE-Hz for patch@linaro.org; Thu, 28 May 2015 07:18:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxvn5-00064Y-Rg for qemu-devel@nongnu.org; Thu, 28 May 2015 07:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yxvn4-00033j-NZ for qemu-devel@nongnu.org; Thu, 28 May 2015 07:15:59 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:19707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxvmy-0002tj-G6; Thu, 28 May 2015 07:15:52 -0400 Received: from 172.24.2.119 (EHLO szxeml432-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CMA87066; Thu, 28 May 2015 19:14:30 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.158.1; Thu, 28 May 2015 19:14:21 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 19:13:45 +0800 Message-ID: <1432811625-13392-5-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432811625-13392-1-git-send-email-zhaoshenglong@huawei.com> References: <1432811625-13392-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: 119.145.14.65 Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mjt@tls.msk.ru, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH 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.217.182 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index a9f9f66..6c5e584 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -1014,6 +1014,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp) if (fcode_filename) { ret = load_image_targphys(fcode_filename, s->prom_addr, FCODE_MAX_ROM_SIZE); + g_free(fcode_filename); if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) { error_report("tcx: could not load prom '%s'", TCX_ROM_FILE); }