qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: [Qemu-devel] [PULL 2/3] tests/ide: Free pcibus when finishing a test
Date: Tue, 20 Nov 2018 11:52:22 +0100	[thread overview]
Message-ID: <1542711143-1946-3-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1542711143-1946-1-git-send-email-thuth@redhat.com>

Once a test has finished, the pcibus structure should be freed, to
avoid leaking memory and to make sure that the structure is properly
re-initialized when the next test starts.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/ide-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/ide-test.c b/tests/ide-test.c
index 33cef61..f0280e6 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -142,6 +142,10 @@ static void ide_test_start(const char *cmdline_fmt, ...)
 
 static void ide_test_quit(void)
 {
+    if (pcibus) {
+        qpci_free_pc(pcibus);
+        pcibus = NULL;
+    }
     pc_alloc_uninit(guest_malloc);
     guest_malloc = NULL;
     qtest_end();
-- 
1.8.3.1

  parent reply	other threads:[~2018-11-20 10:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 10:52 [Qemu-devel] [PULL 0/3] qtest patches Thomas Huth
2018-11-20 10:52 ` [Qemu-devel] [PULL 1/3] tests: add qmp/missing-any-arg test Thomas Huth
2018-11-20 10:52 ` Thomas Huth [this message]
2018-11-20 10:52 ` [Qemu-devel] [PULL 3/3] qtest: log QEMU command line Thomas Huth
2018-11-20 11:36 ` [Qemu-devel] [PULL 0/3] qtest patches Peter Maydell

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=1542711143-1946-3-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).