From 5047027c4123cb733e34124cdcebf1bc5e89a757 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 28 Apr 2011 15:25:53 -0300 Subject: [RHEL6 qemu-kvm PATCH 5/9] char: Detect chardev release by NULL handlers as well as NULL opaque RH-Author: Amit Shah Message-id: <50e762d47cebcf74b2669fe8549346c76678d8fb.1304003635.git.amit.shah@redhat.com> Patchwork-id: 23117 O-Subject: [RHEL6.2 qemu-kvm PATCH 5/6] char: Detect chardev release by NULL handlers as well as NULL opaque Bugzilla: 656779 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Markus Armbruster RH-Acked-by: Jes Sorensen Juan says he prefers these extra checks to ensure a user of a chardev is releasing it. Requested-by: Juan Quintela Signed-off-by: Amit Shah (cherry-picked from commit da7d998bbb80f141ed5743418a4dfa5c1409e75f) Bugzilla: 656779 Signed-off-by: Amit Shah --- qemu-char.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost --- qemu-char.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 6e9dfb1..38148a0 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -208,7 +208,7 @@ void qemu_chr_add_handlers(CharDriverState *s, if (!s) { return; } - if (!opaque) { + if (!opaque && !handlers) { /* chr driver being released. */ ++s->avail_connections; } -- 1.7.3.2