macaroons: don't zero mem if never unlocked

This commit is contained in:
Matt Drollette 2018-03-17 18:34:19 -05:00 committed by Olaoluwa Osuntokun
parent 0c1b619e53
commit 92eebff64e

@ -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()
}