From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47195 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTzWv-0007un-54 for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:48:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTzWo-0001If-Hd for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:48:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45241) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTzWo-0001IX-8U for qemu-devel@nongnu.org; Wed, 30 Jun 2010 11:48:46 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5UFmjXJ012796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Jun 2010 11:48:45 -0400 From: Kevin Wolf Date: Wed, 30 Jun 2010 17:48:33 +0200 Message-Id: <1277912914-21771-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1277912914-21771-1-git-send-email-kwolf@redhat.com> References: <1277912914-21771-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] blkdebug: Free QemuOpts after having read the config List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com Forgetting to free them means that the next instance inherits all rules and gets its own rules only additionally. Signed-off-by: Kevin Wolf --- block/blkdebug.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 4ec8ca6..b084782 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -242,6 +242,11 @@ static int add_rule(QemuOpts *opts, void *opaque) return 0; } +static int free_opts(QemuOpts *opts, void *opaque) { + qemu_opts_del(opts); + return 0; +} + static int read_config(BDRVBlkdebugState *s, const char *filename) { FILE *f; @@ -267,6 +272,8 @@ static int read_config(BDRVBlkdebugState *s, const char *filename) ret = 0; fail: + qemu_opts_foreach(&inject_error_opts, free_opts, NULL, 0); + qemu_opts_foreach(&set_state_opts, free_opts, NULL, 0); fclose(f); return ret; } -- 1.6.6.1