From 92eebff64e1c74501f2755ab50892bcee39dc593 Mon Sep 17 00:00:00 2001 From: Matt Drollette Date: Sat, 17 Mar 2018 18:34:19 -0500 Subject: [PATCH] macaroons: don't zero mem if never unlocked --- macaroons/store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macaroons/store.go b/macaroons/store.go index b17a31150..a37b24d29 100644 --- a/macaroons/store.go +++ b/macaroons/store.go @@ -196,6 +196,8 @@ func (r *RootKeyStorage) RootKey(_ context.Context) ([]byte, []byte, error) { // Close closes the underlying database and zeroes the encryption key stored // in memory. func (r *RootKeyStorage) Close() error { - r.encKey.Zero() + if r.encKey != nil { + r.encKey.Zero() + } return r.DB.Close() }