Skip to content

device: fix memory leak

Beniamino Galvani requested to merge bg/mem into main

l3cd instances must be removed from the old l3cfg before calling _cleanup_ip_pre(). Otherwise, _cleanup_ip_pre() unregisters them from the device, and later _dev_l3_register_l3cds(self, l3cfg_old, FALSE, FALSE) does nothing because the device doesn't have any l3cd.

Previously the l3cds would linger in the l3cfg, keeping a reference to it and causing a memory leak; the leak was not detected by valgrind because the l3cfg was still referenced by the NMNetns.

Fixes: 58287cbc ('core: rework IP configuration in NetworkManager using layer 3 configuration') Fixes-test: @stable_mem_consumption2

https://bugzilla.redhat.com/show_bug.cgi?id=2083453

Merge request reports