qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] blkdebug: Free QemuOpts after having read the config
Date: Wed, 30 Jun 2010 17:48:33 +0200	[thread overview]
Message-ID: <1277912914-21771-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1277912914-21771-1-git-send-email-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 <kwolf@redhat.com>
---
 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

  parent reply	other threads:[~2010-06-30 15:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-30 15:48 [Qemu-devel] [PATCH 0/3] blkdebug: Fix config with multiple states Kevin Wolf
2010-06-30 15:48 ` [Qemu-devel] [PATCH 1/3] blkdebug: Fix set_state_opts definition Kevin Wolf
2010-06-30 15:48 ` Kevin Wolf [this message]
2010-07-01  6:47   ` [Qemu-devel] [PATCH 2/3] blkdebug: Free QemuOpts after having read the config Markus Armbruster
2010-07-01  7:29     ` Kevin Wolf
2010-06-30 15:48 ` [Qemu-devel] [PATCH 3/3] blkdebug: Initialize state as 1 Kevin Wolf
2010-07-01  6:50 ` [Qemu-devel] [PATCH 0/3] blkdebug: Fix config with multiple states Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1277912914-21771-3-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).