From 3f39d6e807228916e424ffd45036f26151f688c1 Mon Sep 17 00:00:00 2001 From: Ruidong Cao Date: Thu, 18 Oct 2018 06:55:05 +0800 Subject: [PATCH] virtcontainers: Add missing API release calls Add missing release sandbox calls to network related functions in virtcontainers API. Fixes #732. Signed-off-by: Ruidong Cao --- virtcontainers/api.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/virtcontainers/api.go b/virtcontainers/api.go index 3573b3707f..aa45642d82 100644 --- a/virtcontainers/api.go +++ b/virtcontainers/api.go @@ -874,9 +874,12 @@ func toggleInterface(ctx context.Context, sandboxID string, inf *grpc.Interface, if err != nil { return nil, err } + defer s.releaseStatelessSandbox() + if add { return s.AddInterface(inf) } + return s.RemoveInterface(inf) } @@ -906,6 +909,7 @@ func ListInterfaces(ctx context.Context, sandboxID string) ([]*grpc.Interface, e if err != nil { return nil, err } + defer s.releaseStatelessSandbox() return s.ListInterfaces() } @@ -926,6 +930,8 @@ func UpdateRoutes(ctx context.Context, sandboxID string, routes []*grpc.Route) ( if err != nil { return nil, err } + defer s.releaseStatelessSandbox() + return s.UpdateRoutes(routes) } @@ -945,6 +951,7 @@ func ListRoutes(ctx context.Context, sandboxID string) ([]*grpc.Route, error) { if err != nil { return nil, err } + defer s.releaseStatelessSandbox() return s.ListRoutes() }