macaroons: don't zero mem if never unlocked

This commit is contained in:
Matt Drollette authored and Olaoluwa Osuntokun committed 2018-03-18 16:09:54 -07:00
1 parent 0c1b619e53
commit 92eebff64e
1 file changed
+3 -1
+3 -1
View File
@@ -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()
}