]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_monitor_json: Use g_autoptr() for virJSONValue
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 21 Oct 2021 08:14:47 +0000 (10:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Oct 2021 11:42:43 +0000 (13:42 +0200)
commit551f91b4cb0e9fe4bfb853a72a83e3bfab6bfbb3
tree67668e052d5c3737df99f462c64733b0270909cb
parent40bbcb47cc734b9e75fd346cb5c5409a0ab63a14
qemu_monitor_json: Use g_autoptr() for virJSONValue

A lot of explicit free calls can be saved when virJSONValue
variables are declared with g_autoptr(). There's one caveat:
there was a slight deviation from our usual pattern such that
@cmd variable was not initialized to NULL but as the very first
step it was assigned a value using qemuMonitorJSONMakeCommand().
While this works in theory it upset my GCC-11.2 (but only when
building with -O2). So I had to initialize the variable in such
case too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
src/qemu/qemu_monitor_json.c