diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 6e74f5b0347..0d4e816f6ab 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -322,7 +322,7 @@ func AddWithContext(ctx context.Context, n *core.IpfsNode, r io.Reader) (string, // AddR recursively adds files in |path|. func AddR(n *core.IpfsNode, root string) (key string, err error) { - n.Blockstore.PinLock().Unlock() + defer n.Blockstore.PinLock().Unlock() stat, err := os.Lstat(root) if err != nil {