From: Li Qiang <liq3ea@gmail.com>
To: kraxel@redhat.com
Cc: qemu-devel@nongnu.org, liq3ea@163.com, Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH 1/2] hw: ccid-card-emulated: introduce clean_event_notifier
Date: Fri, 19 Oct 2018 03:50:35 -0700 [thread overview]
Message-ID: <1539946236-18028-2-git-send-email-liq3ea@gmail.com> (raw)
In-Reply-To: <1539946236-18028-1-git-send-email-liq3ea@gmail.com>
Call it in device unrealize function.
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
hw/usb/ccid-card-emulated.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index 5c8b3c9..b356edb 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -409,6 +409,12 @@ static int init_event_notifier(EmulatedState *card, Error **errp)
return 0;
}
+static void clean_event_notifier(EmulatedState *card)
+{
+ event_notifier_set_handler(&card->notifier, NULL);
+ event_notifier_cleanup(&card->notifier);
+}
+
#define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb"
#define CERTIFICATES_ARGS_TEMPLATE\
"db=\"%s\" use_hw=no soft=(,Virtual Reader,CAC,,%s,%s,%s)"
@@ -556,6 +562,7 @@ static void emulated_unrealize(CCIDCardState *base, Error **errp)
qemu_cond_signal(&card->handle_apdu_cond);
qemu_thread_join(&card->apdu_thread_id);
+ clean_event_notifier(card);
/* threads exited, can destroy all condvars/mutexes */
qemu_cond_destroy(&card->handle_apdu_cond);
qemu_mutex_destroy(&card->handle_apdu_mutex);
--
1.8.3.1
next prev parent reply other threads:[~2018-10-19 10:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 10:50 [Qemu-devel] [PATCH 0/2] hw: ccid-card-emulated: fix some resources leak Li Qiang
2018-10-19 10:50 ` Li Qiang [this message]
2018-10-19 10:50 ` [Qemu-devel] [PATCH 2/2] hw: ccid-card-emulated: cleanup resource when realize in error path Li Qiang
2018-10-19 11:56 ` Philippe Mathieu-Daudé
2018-10-29 9:46 ` [Qemu-devel] [PATCH 0/2] hw: ccid-card-emulated: fix some resources leak Gerd Hoffmann
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=1539946236-18028-2-git-send-email-liq3ea@gmail.com \
--to=liq3ea@gmail.com \
--cc=kraxel@redhat.com \
--cc=liq3ea@163.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).