Skip to content

Commit 039b1cc

Browse files
JooyoungPark73leokondrashov
authored andcommitted
fix use after free issue
Signed-off-by: JooYoung Park <[email protected]>
1 parent 1ccb542 commit 039b1cc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

networking/networkManager.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,18 @@ func (mgr *NetworkManager) allocNetConfig(funcID string) *NetworkConfig {
170170

171171
// releaseNetConfig releases the network config of a given function instance with id funcID back to the pool
172172
func (mgr *NetworkManager) releaseNetConfig(funcID string) {
173+
logger := log.WithFields(log.Fields{"funcID": funcID})
174+
173175
mgr.Lock()
174-
config := mgr.netConfigs[funcID]
176+
config, ok := mgr.netConfigs[funcID]
177+
if !ok {
178+
mgr.Unlock()
179+
logger.Warn("failed to find network config for function")
180+
return
181+
}
175182
delete(mgr.netConfigs, funcID)
176183
mgr.Unlock()
177184

178-
logger := log.WithFields(log.Fields{"funcID": funcID})
179185
logger.Debug("Releasing network config from function instance and adding it to network pool")
180186

181187
// Add network config back to the pool. We allow the pool to grow over it's configured size here since the

0 commit comments

Comments
 (0)