diff --git a/x/wasm/keeper/snapshotter.go b/x/wasm/keeper/snapshotter.go index a781cb0..2b7a01b 100644 --- a/x/wasm/keeper/snapshotter.go +++ b/x/wasm/keeper/snapshotter.go @@ -50,7 +50,12 @@ func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) e if err != nil { return err } - + defer func() { + // We should close the multistore to avoid leaking resources. + if closer, ok := cacheMS.(io.Closer); ok { + _ = closer.Close() + } + }() ctx := sdk.NewContext(cacheMS, tmproto.Header{}, false, log.NewNopLogger()) seenBefore := make(map[string]bool) var rerr error