Skip to contentSkip to conversation

qemu-char: do not leak QemuMutex when freeing a character device

PATCH In review Paolo Bonzini 2 participants 2 messages Jan 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-char: do not leak QemuMutex when freeing a character device

The leak is only apparent on Win32. On POSIX platforms destroying a mutex is not necessary.

---
 qemu-char.c | 1 +
 1 file changed, 1 insertion(+)
qemu-char.c +1 -0
index 02b0318..c7b8699 100644
@@ -3967,6 +3967,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);
 }
 
Signature · 1 line
2.5.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Paolo Bonzini

The leak is only apparent on Win32. On POSIX platforms destroying a mutex is not necessary.

---
 qemu-char.c | 1 +
 1 file changed, 1 insertion(+)

qemu-char.c static void qemu_chr_free_common(CharDriverState *chr) · line 3972

Quoted 11 lines
qemu-char.c +1 -0
index 02b0318..c7b8699 100644
@@ -3967,6 +3967,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);
 }

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|