From patchwork Wed Jun 3 13:08:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 49479 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8A61820DDC for ; Wed, 3 Jun 2015 15:39:54 +0000 (UTC) Received: by laboh3 with SMTP id oh3sf4214393lab.0 for ; Wed, 03 Jun 2015 08:39:53 -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=u5N52I9BDLTOg9gNFjQAZqO7nJb1D/cfyv+S+p6JlS8=; b=JOpGkt0To0Ymao2c6wJhOOfBbGFw9ntvDXyFOWVnDZc+kirlE2rakGht46tLKgsitw sWPT4HKI8/EA7e+bFb1uzLNnvyQc3cfWYWalglfs/SF2oNJlfSandF/y1ebjzvDf87gT 3wLC/GmooWJnDFJ2+XxDI93QKl11Zu9VAVXM0ISgJGxlbbfooftyNSgXcL5VC/njDWMh za21vfWP0ITDG2ARXgsopnEbvoRyK05gyvzQ57ZjokwLUWC9TmU95nQB8P4Y98gG8ZcW 09B4vJbTRpzMQZocyclbyQjcWtcAjKrxJJpQPg6tTIIxKQvXv3NKTVOMsK6AkUxdsUM9 f0QQ== X-Gm-Message-State: ALoCoQnu2bKtl4A8IsvazGgwOtqjnEZtoTMAdoP8dJpKoD1WSTfQuF+f9egZwssrEiTwOTzgq+bj X-Received: by 10.112.219.200 with SMTP id pq8mr31285862lbc.7.1433345993432; Wed, 03 Jun 2015 08:39:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.232 with SMTP id p8ls80685laf.13.gmail; Wed, 03 Jun 2015 08:39:53 -0700 (PDT) X-Received: by 10.112.168.102 with SMTP id zv6mr32647218lbb.45.1433345993278; Wed, 03 Jun 2015 08:39:53 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id uo9si1395146lbb.12.2015.06.03.08.39.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2015 08:39:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laew7 with SMTP id w7so11356809lae.1 for ; Wed, 03 Jun 2015 08:39:53 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr32733810lae.19.1433345993144; Wed, 03 Jun 2015 08:39:53 -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 hn6csp3956706lbb; Wed, 3 Jun 2015 08:39:52 -0700 (PDT) X-Received: by 10.55.53.70 with SMTP id c67mr28973273qka.62.1433345991369; Wed, 03 Jun 2015 08:39:51 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w45si960327qgw.25.2015.06.03.08.39.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Jun 2015 08:39:51 -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]:36281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Ali-000545-EQ for patch@linaro.org; Wed, 03 Jun 2015 11:39:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Aie-0000Iz-IP for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0Aib-0004iS-3u for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:36:40 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:40391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Aia-0004hH-T8; Wed, 03 Jun 2015 11:36:37 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 0AAB9407DE; Wed, 3 Jun 2015 18:36:34 +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 11087A52; Wed, 3 Jun 2015 16:08:53 +0300 (MSK) Received: (nullmailer pid 27430 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:29 +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 09/30] 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: 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.47 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 Signed-off-by: Michael Tokarev --- vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 1d4c089..3893c84 100644 --- a/vl.c +++ b/vl.c @@ -4312,8 +4312,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