From patchwork Tue Dec 1 14:24:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 39912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C8C17B6F09 for ; Wed, 2 Dec 2009 01:27:50 +1100 (EST) Received: from localhost ([127.0.0.1]:36462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFThi-0005MQ-7A for incoming@patchwork.ozlabs.org; Tue, 01 Dec 2009 09:27:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFTeU-0004au-Ga for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:24:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFTeP-0004Yh-BY for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:24:26 -0500 Received: from [199.232.76.173] (port=36774 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFTeO-0004YW-Vf for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:24:21 -0500 Received: from david.siemens.de ([192.35.17.14]:15490) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NFTeO-00061K-JH for qemu-devel@nongnu.org; Tue, 01 Dec 2009 09:24:20 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id nB1EOIAr028209; Tue, 1 Dec 2009 15:24:18 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail1.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id nB1EOIno020456; Tue, 1 Dec 2009 15:24:18 +0100 Message-ID: <4B152712.4030705@siemens.com> Date: Tue, 01 Dec 2009 15:24:18 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: qemu-devel Subject: [Qemu-devel] [PATCH] qemu-opts: Release id on deletion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The opts id is always allocated via qemu_strdup, so it need not be const, but it has to be released on opts deletion. Signed-off-by: Jan Kiszka --- qemu-option.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index 49efd39..b009109 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -481,7 +481,7 @@ struct QemuOpt { }; struct QemuOpts { - const char *id; + char *id; QemuOptsList *list; QTAILQ_HEAD(QemuOptHead, QemuOpt) head; QTAILQ_ENTRY(QemuOpts) next; @@ -686,6 +686,7 @@ void qemu_opts_del(QemuOpts *opts) qemu_opt_del(opt); } QTAILQ_REMOVE(&opts->list->head, opts, next); + qemu_free(opts->id); qemu_free(opts); }