]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuMonitorJSONQueryRxFilterParse: Set *filter only on success
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Oct 2021 05:17:03 +0000 (07:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Oct 2021 11:42:22 +0000 (13:42 +0200)
commit4b1b14170a0cfcf1a8c3d9429658b3c6399df5c4
treeeb012a2e4f626178f58342c5543c47894baad66e
parent4e8bb57859e60570317c59c2fdc6b223af3be1a2
qemuMonitorJSONQueryRxFilterParse: Set *filter only on success

The qemuMonitorJSONQueryRxFilterParse() function is called to
parse the output of 'query-rx-filter' and store results into
passed virNetDevRxFilter structure. However, it is doing so in a
bit clumsy way - the return pointer is set in all cases (i.e.
even in case of error) and thus the cleanup label is more
complicated than it needs to be. With a help of g_autoptr() and
g_steal_pointer() the return pointer can be set only in case of
success - which is what callers expect anyway.

The same applies to qemuMonitorJSONQueryRxFilter().

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