]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virchrdev: Don't leak mutex if virChrdevAlloc() fails
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Jan 2020 08:18:30 +0000 (09:18 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 16 Jan 2020 13:13:47 +0000 (14:13 +0100)
This is only a theoretical leak, but in virChrdevAlloc() we
initialize a mutex and if creating a hash table fails,
then virChrdevFree() is called which because of incorrect check
doesn't deinit the mutex.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/conf/virchrdev.c

index 7657c41eceb97c10680baffb1bb10b3e451b6093..6e659a3783f1394376e2849cd32803f25157e2cc 100644 (file)
@@ -311,7 +311,7 @@ static int virChrdevFreeClearCallbacks(void *payload,
  */
 void virChrdevFree(virChrdevsPtr devs)
 {
-    if (!devs || !devs->hash)
+    if (!devs)
         return;
 
     virMutexLock(&devs->lock);