]> git.proxmox.com Git - qemu.git/commitdiff
char: Detect chardev release by NULL handlers as well as NULL opaque
authorAmit Shah <amit.shah@redhat.com>
Mon, 25 Apr 2011 09:48:22 +0000 (15:18 +0530)
committerAmit Shah <amit.shah@redhat.com>
Thu, 28 Apr 2011 05:41:04 +0000 (11:11 +0530)
Juan says he prefers these extra checks to ensure a user of a chardev is
releasing it.

Requested-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
qemu-char.c

index eaf6571ac8a911a504b570e2677f25c7cf9db700..5e04a20b8c4dd04ff14be2679439f51d237873d9 100644 (file)
@@ -197,7 +197,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
                            IOEventHandler *fd_event,
                            void *opaque)
 {
-    if (!opaque) {
+    if (!opaque && !fd_can_read && !fd_read && !fd_event) {
         /* chr driver being released. */
         ++s->avail_connections;
     }