qemu-char: do not leak QemuMutex when freeing a character device
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Jan 2016 15:16:25 +0000 (16:16 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Jan 2016 17:58:02 +0000 (18:58 +0100)
The leak is only apparent on Win32.  On POSIX platforms destroying a
mutex is not necessary.

Reported-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-char.c

index 11caa56..e133f4f 100644 (file)
@@ -3972,6 +3972,7 @@ static void qemu_chr_free_common(CharDriverState *chr)
     if (chr->logfd != -1) {
         close(chr->logfd);
     }
+    qemu_mutex_destroy(&chr->chr_write_lock);
     g_free(chr);
 }