Unlock mutex before returning from function

mapMutex is initialized in the ContainerRm function and cannot be released from outside,
thus unlock mutex before returning from function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Егор Макрушин <emakrushin@astralinux.ru>
This commit is contained in:
Егор Макрушин 2024-10-14 16:50:42 +03:00
parent 7ea6120794
commit 06b470d79b
1 changed files with 1 additions and 0 deletions

View File

@ -467,6 +467,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
errMap, err := parallelctr.ContainerOp(ctx, libpodContainers, func(c *libpod.Container) error {
mapMutex.Lock()
if _, ok := ctrsMap[c.ID()]; ok {
mapMutex.Unlock()
return nil
}
mapMutex.Unlock()