]> git.ipfire.org Git - thirdparty/libvirt.git/commit
esx: fix memory leak by switching to g_autofree
authorLaine Stump <laine@redhat.com>
Fri, 12 Feb 2021 17:53:33 +0000 (12:53 -0500)
committerLaine Stump <laine@redhat.com>
Tue, 16 Feb 2021 18:50:04 +0000 (13:50 -0500)
commitd79a6e2c8c012a910ce52c2202722dff601e2ff8
treeeca8ac78ca0543d62689da33e4a90241468f32fd
parent22a370d8b14db4c57b659f0b8b1c0c447045005f
esx: fix memory leak by switching to g_autofree

volumeName was defined at the top of the function, then a new string
was assigned to it each time through a loop, but after the first
iteration of the loop, the previous string wasn't freed before
allocating a new string the next time. By reducing the scope of
volumeName to be just the loop, and making it g_autofree, we eliminate
the leak.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/esx/esx_storage_backend_vmfs.c