From patchwork Mon May 25 06:47:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48947 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6EBB921411 for ; Mon, 25 May 2015 06:54:09 +0000 (UTC) Received: by wgwl7 with SMTP id l7sf19839871wgw.0 for ; Sun, 24 May 2015 23:54:08 -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 :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=PVd2zvbtDY4332bc+MhpVQfzxAJpTz0J/Hz/csMXl+Q=; b=MlFd/pJ6U2W76Gh40ne/oqJMoJmISXqqGFm8hSRNSJfyrxg+OzMdnYpriA/+YgO57M 0q3g4sEPqu+BEXWCKTruu/1hl30jN/go9qOyQRGd3JPAMeEbqQ+kApk+w/4b1+k5sNnW 7UqCJ0tEtVmKGFGIeekEAEpG28/ZspHGTAUhck9tjtKLWFpxkswpOvgvA+apvnRmuBeF RwKTmgFzD8RDhCPVUxFPq9NLRFhtj/DOhwZo/MIjf1O8EKSsEqYfYVk/yZTXLK7HNWJR gAWgmvXkwVKqIi2MPnEQKjGPKShidj+8zyB8uEDEov7LEwtxiQ0Y6t/SOqxfq3TcavnC MFyw== X-Gm-Message-State: ALoCoQkydo6LgKyEdgzCZVN8kUPjCyapNsjHVBFHoyL9M9874qTr6Owfgm6KKU/+0eZsi49jSmqf X-Received: by 10.112.122.39 with SMTP id lp7mr20985856lbb.5.1432536848422; Sun, 24 May 2015 23:54:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.163 with SMTP id an3ls764060lac.90.gmail; Sun, 24 May 2015 23:54:08 -0700 (PDT) X-Received: by 10.112.156.231 with SMTP id wh7mr178876lbb.118.1432536848304; Sun, 24 May 2015 23:54:08 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id n4si7163394laj.18.2015.05.24.23.54.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 May 2015 23:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbuc2 with SMTP id uc2so46153719lbb.2 for ; Sun, 24 May 2015 23:54:08 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr17016854lbb.36.1432536848030; Sun, 24 May 2015 23:54:08 -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 hn6csp1640791lbb; Sun, 24 May 2015 23:54:07 -0700 (PDT) X-Received: by 10.140.237.147 with SMTP id i141mr27097593qhc.25.1432536846646; Sun, 24 May 2015 23:54:06 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z128si5480542qkz.44.2015.05.24.23.54.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 24 May 2015 23:54:06 -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]:42200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwmGz-0005mz-UE for patch@linaro.org; Mon, 25 May 2015 02:54:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwmGZ-0005WL-Pr for qemu-devel@nongnu.org; Mon, 25 May 2015 02:53:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwmGV-0000qf-Hr for qemu-devel@nongnu.org; Mon, 25 May 2015 02:53:39 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:20672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwmGM-0000Pi-5E; Mon, 25 May 2015 02:53:26 -0400 Received: from 172.24.2.119 (EHLO szxeml432-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGM97759; Mon, 25 May 2015 14:48:06 +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; Mon, 25 May 2015 14:47:59 +0800 From: Shannon Zhao To: Date: Mon, 25 May 2015 14:47:25 +0800 Message-ID: <1432536445-12760-1-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5562C5A6.0119, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 14aa1eb88d73f80a8e7e419a673810eb X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: qemu-trivial@nongnu.org, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH] vl: 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.173 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: ==9276== 13 bytes in 1 blocks are definitely lost in loss record 1,046 of 3,673 ==9276== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==9276== by 0x2EAFBB: malloc_and_trace (vl.c:2556) ==9276== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==9276== by 0x4A28BD: addr_to_string (vnc.c:123) ==9276== by 0x4A29AD: vnc_socket_local_addr (vnc.c:139) ==9276== by 0x4A9AFE: vnc_display_local_addr (vnc.c:3240) ==9276== by 0x2EF4FE: main (vl.c:4321) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 74c2681..9539e7b 100644 --- a/vl.c +++ b/vl.c @@ -4295,8 +4295,9 @@ int main(int argc, char **argv, char **envp) /* init remote displays */ qemu_opts_foreach(qemu_find_opts("vnc"), vnc_init_func, NULL, 0); if (show_vnc_port) { - printf("VNC server running on `%s'\n", - vnc_display_local_addr("default")); + char *ret = vnc_display_local_addr("default"); + printf("VNC server running on `%s'\n", ret); + g_free(ret); } #endif #ifdef CONFIG_SPICE