On Fri, Jun 13, 2025 at 04:51:10PM +0800, Li Zhijian wrote: > This leak was detected by the valgrind. > > The crs_range_merge() function unconditionally allocated a GPtrArray > 'even when range->len was zero, causing an early return without freeing > the allocated array. This resulted in a memory leak when an empty range > was processed. > > Instead of moving the allocation after the check (as previously attempted), > use g_autoptr for automatic cleanup. This ensures the array is freed even > on early returns, and also removes the need for the explicit free at the > end of the function. > > Signed-off-by: Li Zhijian <lizhij...@fujitsu.com> > ---
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|