* [Qemu-devel] [PATCH] iohandlers: fix issue with qemu_set_fd_handler()
@ 2011-09-07 18:46 Anthony Liguori
0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2011-09-07 18:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori
As spotted by Aneesh, some users pass a NULL opaque so we need to be more
aggressive in checking whether a user means to unregister.
Also fix a double free caused by tag not being reset to zero after delete.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
iohandler.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/iohandler.c b/iohandler.c
index 5ef66fb..4cc1c5a 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -93,10 +93,6 @@ static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaq
{
IOTrampoline *tramp = opaque;
- if (tramp->opaque == NULL) {
- return FALSE;
- }
-
if ((cond & G_IO_IN) && tramp->fd_read) {
tramp->fd_read(tramp->opaque);
}
@@ -119,9 +115,10 @@ int qemu_set_fd_handler(int fd,
if (tramp->tag != 0) {
g_io_channel_unref(tramp->chan);
g_source_remove(tramp->tag);
+ tramp->tag = 0;
}
- if (opaque) {
+ if (fd_read || fd_write || opaque) {
GIOCondition cond = 0;
tramp->fd_read = fd_read;
--
1.7.4.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-07 18:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07 18:46 [Qemu-devel] [PATCH] iohandlers: fix issue with qemu_set_fd_handler() Anthony Liguori
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).