提交 15b82112 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 aab37799
...@@ -311,7 +311,7 @@ static int virChrdevFreeClearCallbacks(void *payload, ...@@ -311,7 +311,7 @@ static int virChrdevFreeClearCallbacks(void *payload,
*/ */
void virChrdevFree(virChrdevsPtr devs) void virChrdevFree(virChrdevsPtr devs)
{ {
if (!devs || !devs->hash) if (!devs)
return; return;
virMutexLock(&devs->lock); virMutexLock(&devs->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册