From patchwork Wed Jun 30 15:48:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/3] blkdebug: Free QemuOpts after having read the config Date: Wed, 30 Jun 2010 05:48:33 -0000 From: Kevin Wolf X-Patchwork-Id: 57427 Message-Id: <1277912914-21771-3-git-send-email-kwolf@redhat.com> 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; }