]> git.ipfire.org Git - thirdparty/libvirt.git/commit
node_device: Don't leak error message buffer from virMdevctlListDefined|Active
authorPeter Krempa <pkrempa@redhat.com>
Wed, 19 Jul 2023 13:22:22 +0000 (15:22 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Jul 2023 13:25:03 +0000 (15:25 +0200)
commit7ca777cc09242cb3a30b12d5e0e396c6aaf1a5e7
tree5c65051d6e664faabf63263f1cf3c5e4affc8214
parent294cf405d594fa8de5b976999fa6c7f44677d7e6
node_device: Don't leak error message buffer from virMdevctlListDefined|Active

nodeDeviceUpdateMediatedDevices invokes virMdevctlListDefined and
virMdevctlListActive both of which were passed the same 'errmsg' buffer.

Since virCommandSetErrorBuffer() always allocates the error buffer one
of them was leaked.

Fix it by populating the 'errmsg' buffer only on failure of
virMdevctlListActive|Defined which invoke the command.

Add a comment to nodeDeviceGetMdevctlListCommand reminding how
virCommandSetErrorBuffer() works.

Fixes: 44a0f2f0c8f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
src/node_device/node_device_driver.c