tests: fix double unlock of monitor in hotplug test
tests: fix double unlock of monitor in hotplug test

The qemuMonitorTestNew() function returns with the monitor object
locked, and expects it to still be locked when qemuMonitorTestFree
is called.  The qemuhotplug test, however, explicitly unlocks the
monitor, but then forgets to lock it again. As a result the
qemuMonitorTestFree function is unlocking a mutex it doesn't own.

This bug has existed forever, but since we use normal POSIX mutexes
and don't check the return value of pthread_mutex_lock/unlock we
didn't see the error. It was harmless until the switch to the per
monitor event loop which requires the thread synchronization to
work reliably, whereupon it started crashing.

Reviewed-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Signed-off-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

jardasgit/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,zippy2/libvirt,olafhering/libvirt,jfehlig/libvirt,jfehlig/libvirt,olafhering/libvirt,libvirt/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,jardasgit/libvirt,zippy2/libvirt,jfehlig/libvirt,libvirt/libvirt,zippy2/libvirt,crobinso/libvirt,olafhering/libvirt,nertpinx/libvirt,jfehlig/libvirt,nertpinx/libvirt,libvirt/libvirt,libvirt/libvirt,jardasgit/libvirt,crobinso/libvirt,crobinso/libvirt,olafhering/libvirt,jardasgit/libvirt,jardasgit/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,crobinso/libvirt,zippy2/libvirt