mirror of https://gitee.com/openkylin/libvirt.git
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 <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
aab3779994
commit
15b821122e
|
@ -311,7 +311,7 @@ static int virChrdevFreeClearCallbacks(void *payload,
|
|||
*/
|
||||
void virChrdevFree(virChrdevsPtr devs)
|
||||
{
|
||||
if (!devs || !devs->hash)
|
||||
if (!devs)
|
||||
return;
|
||||
|
||||
virMutexLock(&devs->lock);
|
||||
|
|
Loading…
Reference in New Issue