Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix to a Seg Fault issue #10

Merged
merged 2 commits into from
Nov 24, 2021
Merged

Quick fix to a Seg Fault issue #10

merged 2 commits into from
Nov 24, 2021

Conversation

DanielSollis
Copy link
Contributor

I was running into Seg-Faults while implementing tests for Benjamin's PR and found this bug.

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #10 (591a836) into main (874b55c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #10   +/-   ##
=======================================
  Coverage   44.10%   44.10%           
=======================================
  Files           6        6           
  Lines         331      331           
=======================================
  Hits          146      146           
  Misses        155      155           
  Partials       30       30           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 874b55c...591a836. Read the comment docs.

@@ -115,6 +119,10 @@ func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err erro

// Thread-unsafe put that is called both by the Transaction and the Store.
func (db *LevelDBEngine) put(key, value []byte, options *opts.Options) (err error) {
// Create a default to prevent SigFaults when accessing options{}
if options == nil {
options = &opts.Options{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, mind if we use opts.New() to make sure that we have the default options, e.g. the namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, updated.

Copy link
Member

@rebeccabilbro rebeccabilbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @DanielSollis for the great catch and quick fix!

@rebeccabilbro rebeccabilbro merged commit f871cd3 into main Nov 24, 2021
@rebeccabilbro rebeccabilbro deleted the quick-segfault-fix branch November 24, 2021 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants