]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: fix memory leak in virNetServerClientNew and virNetServerProgramDispatchCall
authorjiangjiacheng <jiangjiacheng@huawei.com>
Fri, 30 Sep 2022 07:02:47 +0000 (15:02 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 3 Oct 2022 14:30:20 +0000 (16:30 +0200)
commit41eb0f446c8f50064a6597d7eb8cf0d227919c0b
treef8b5bf88123c6a516a4ad838054cca2059fbed4d
parent8802c38fd51ba1c918753751542655bf3871333c
rpc: fix memory leak in virNetServerClientNew and virNetServerProgramDispatchCall

In virNetServerProgramDispatchCall, The arg is passed as a void*
and used to point to a certain struct depended on the dispatcher,
so I think it's the memory of the struct's member that leaks and
this memory shuld be freed by xdr_free.

In virNetServerClientNew, client->rx is assigned by invoking
virNetServerClientNew, but isn't freed if client->privateData's
initialization failed, which leads to a memory leak. Thanks to
Liang Peng's suggestion, put virNetMessageFree(client->rx) into
virNetServerClientDispose() to release the memory.

Signed-off-by: jiangjiacheng <jiangjiacheng@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/rpc/virnetserverclient.c
src/rpc/virnetserverprogram.c