On 21 January 2016 at 11:56, Daniel P. Berrange <berra...@redhat.com> wrote: > The gd_vc_handler() callback is using g_malloc0() to > allocate the CharDriverState struct. As a result the > logfd field is getting initialized to 0, instead of > -1 when no logfile is requested. > > The result is that when running > > $ qemu-system-i386 -nodefaults -chardev vc,id=mon0 -mon chardev=mon0 > > qemu duplicates all monitor output to stdout as well > as the GTK window. > > Not using qemu_chr_alloc() was already a bug, but harmless > until this commit
A quick check with coccinelle: @@ typedef CharDriverState; CharDriverState *x; @@ - x = g_malloc0(...) + x = qemu_chr_alloc(foo) revealed only this ui/gtk.c allocation plus the actual implementation of qemu_chr_alloc() as places where we try to do a manual g_malloc0() of a CharDriverState. So I think this is the only bit that needs changing. thanks -- PMM