]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virNetServerProgramDispatchCall: Avoid calling xdr_free(_, NULL)
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Oct 2022 11:05:03 +0000 (13:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Oct 2022 15:15:49 +0000 (17:15 +0200)
commit8ef8d9e21b10f62cad0c36a6ac2b57ac61acd0ec
tree1ca457203b18bc503e111514143bda2c501b48c3
parent031878c23640ed836bc400dd9c042d5fd85dadb2
virNetServerProgramDispatchCall: Avoid calling xdr_free(_, NULL)

In recent commit of v8.8.0-41-g41eb0f446c I've suggested during
review to put both xdr_free() calls under error label, assuming
that xdr_free() accepts NULL and thus is a NOP when the control
jumps onto the label even before either of @arg or @ret was
allocated. Well, turns out, xdr_free() does no accept NULL and
thus we have to guard its call. But since @dispatcher is already
set by the time either of the variables is allocated, we can
replace the condition from 'if (dispatcher)' to 'if (arg)' and
'if (ret)'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/rpc/virnetserverprogram.c