]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virNWFilterSnoopState: Prevent mutex leak
authorTim Wiederhake <twiederh@redhat.com>
Fri, 8 Apr 2022 10:50:35 +0000 (12:50 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Fri, 8 Apr 2022 14:43:16 +0000 (16:43 +0200)
commit879ecd602fef31f5ce78beda8562fe2974e65241
tree927e2744faa70fc5fac6cae724b6c75c46d94e4d
parentdb2989c3a50e8905ec889ed03e3b7aa02ca2d194
virNWFilterSnoopState: Prevent mutex leak

virNWFilterDHCPSnoopShutdown would never destroy the mutexes created
in virNWFilterDHCPSnoopInit. Additionally, if in virNWFilterDHCPSnoopInit
the call to virMutexInitRecursive succeeds and the call to virMutexInit
fails, this would lead to either virNWFilterSnoopState.snoopLock being
initialized twice or virNWFilterSnoopState.activeLock destroyed without
being initialized first.

This enables a later patch to use virNWFilterDHCPSnoopShutdown as a
cleanup function safely, as it is a no-op if virNWFilterSnoopState was
not yet initialized.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/nwfilter/nwfilter_dhcpsnoop.c