From d7c76d137f60b4adf0eba46e0db67182fca04e69 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Wed, 22 Feb 2023 10:43:52 +0800
Subject: [PATCH 19/19] unlock m_podsLock if new failed

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 src/daemon/entry/cri/network_plugin.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/daemon/entry/cri/network_plugin.cc b/src/daemon/entry/cri/network_plugin.cc
index 00be975e..7a957de3 100644
--- a/src/daemon/entry/cri/network_plugin.cc
+++ b/src/daemon/entry/cri/network_plugin.cc
@@ -347,6 +347,9 @@ void PluginManager::Lock(const std::string &fullPodName, Errors &error)
         auto tmpLock = std::unique_ptr<PodLock>(new (std::nothrow) PodLock());
         if (tmpLock == nullptr) {
             error.SetError("Out of memory");
+            if (pthread_mutex_unlock(&m_podsLock) != 0) {
+                error.SetError("plugin manager unlock failed");
+            }
             return;
         }
         lock = tmpLock.get();
-- 
2.25.1

