Skip to content

Commit

Permalink
Fix (bitcask): nil deref in metadata pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
yunginnanet committed Jul 4, 2024
1 parent 1312a9a commit 42a604c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bitcask/bitcask.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ func (db *DB) discover(force ...bool) ([]string, error) {
aclosed := &atomic.Bool{}
aclosed.Store(false)
db.store[name] = &Store{Bitcask: c, closed: aclosed}
if db.meta == nil {
db.meta = metadata.NewMeta("bitcask")
}
if db.meta.KnownStores == nil {
db.meta.KnownStores = make([]string, 0)
}
if !slices.Contains(db.meta.KnownStores, name) {
db.meta.KnownStores = append(db.meta.KnownStores, name)
}
Expand Down

0 comments on commit 42a604c

Please sign in to comment.