From 15b821122e6c13b796415c06ecf41be167bc519c Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 8 Jan 2020 09:18:30 +0100 Subject: [PATCH] virchrdev: Don't leak mutex if virChrdevAlloc() fails 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 Reviewed-by: Erik Skultety --- src/conf/virchrdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 7657c41ece..6e659a3783 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -311,7 +311,7 @@ static int virChrdevFreeClearCallbacks(void *payload, */ void virChrdevFree(virChrdevsPtr devs) { - if (!devs || !devs->hash) + if (!devs) return; virMutexLock(&devs->lock);