From patchwork Thu Nov 24 08:27:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhi Hui Li X-Patchwork-Id: 127453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1ABB61007D7 for ; Thu, 24 Nov 2011 19:28:05 +1100 (EST) Received: from localhost ([::1]:53561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTUf3-0006Cy-0M for incoming@patchwork.ozlabs.org; Thu, 24 Nov 2011 03:28:01 -0500 Received: from eggs.gnu.org ([140.186.70.92]:36909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTUex-0006Cs-6f for qemu-devel@nongnu.org; Thu, 24 Nov 2011 03:27:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTUev-0006It-Ta for qemu-devel@nongnu.org; Thu, 24 Nov 2011 03:27:55 -0500 Received: from mail-yw0-f45.google.com ([209.85.213.45]:59484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTUev-0006Ij-Kk; Thu, 24 Nov 2011 03:27:53 -0500 Received: by ywf7 with SMTP id 7so2652224ywf.4 for ; Thu, 24 Nov 2011 00:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=ajp9rBhGgUaJfUXQIJqp6k8LqSAW4V7XUYwNKdzI08M=; b=OQmWfJyhfSxxMT63KidwgtXwSxbUO+ddA1DMubYQFQY4oKcvCg0uf2Id5WhEFpHPry 910Bp099oF1YY84pcFA764mqYnxV5UhQhfwXOw99+uYIcMGBxHQL1z3yEDjSon7elAfO thrvhoFyVMJnrSNIZYwj+PcTLvT5lXTExlMDY= MIME-Version: 1.0 Received: by 10.68.38.68 with SMTP id e4mr15408074pbk.126.1322123272634; Thu, 24 Nov 2011 00:27:52 -0800 (PST) Received: by 10.142.242.3 with HTTP; Thu, 24 Nov 2011 00:27:52 -0800 (PST) Date: Thu, 24 Nov 2011 16:27:52 +0800 X-Google-Sender-Auth: t-vYyGIjYHsLm7fnW3uu-hu2p3k Message-ID: From: Zhi Hui Li To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.213.45 Cc: qemu-trivial@nongnu.org, stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH] os-win32.c : fix memory leak 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org string is allocated by g_malloc, will not be used after putenv, should be free before return. Signed-off-by: Li Zhi Hui Tested-by: Stefan Weil Reviewed-by: Paolo Bonzini --- os-win32.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) } diff --git a/os-win32.c b/os-win32.c index 8ad5fa1..e6e9143 100644 --- a/os-win32.c +++ b/os-win32.c @@ -44,6 +44,7 @@ int setenv(const char *name, const char *value, int overwrite) char *string = g_malloc(length); snprintf(string, length, "%s=%s", name, value); result = putenv(string); + g_free(string); } return result;