diff mbox

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

Message ID 1452871021-32405-1-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Jan. 15, 2016, 3:17 p.m. UTC
The leak is only apparent on Win32.  On POSIX platforms destroying a
mutex is not necessary.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-char.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel P. Berrangé Jan. 15, 2016, 3:20 p.m. UTC | #1
On Fri, Jan 15, 2016 at 04:17:01PM +0100, Paolo Bonzini wrote:
> The leak is only apparent on Win32.  On POSIX platforms destroying a
> mutex is not necessary.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qemu-char.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

> diff --git a/qemu-char.c b/qemu-char.c
> index 02b0318..c7b8699 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -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
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 02b0318..c7b8699 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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);
 }