]> git.proxmox.com Git - mirror_qemu.git/commitdiff
gdbstub: init mon_chr through qemu_chr_alloc
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Wed, 10 Sep 2014 14:34:14 +0000 (18:34 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Sep 2014 10:20:33 +0000 (12:20 +0200)
This patch initializes monitor for gdbstub with the qemu_chr_alloc function
instead of just allocating the memory. Initialization function call
is required, because it also creates chr_write_lock mutex, which is used
when writing to this character device.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
gdbstub.c

index 8afe0b701cd59f0738e2ee8ab39aa9f5239dc809..71aaa23da33865e9e1bc4ee9f83d1cc3a74a4a43 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1707,7 +1707,7 @@ int gdbserver_start(const char *device)
         qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);
 
         /* Initialize a monitor terminal for gdb */
-        mon_chr = g_malloc0(sizeof(*mon_chr));
+        mon_chr = qemu_chr_alloc();
         mon_chr->chr_write = gdb_monitor_write;
         monitor_init(mon_chr, 0);
     } else {