-
Notifications
You must be signed in to change notification settings - Fork 291
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
fix: Correct a few potential null derefs in bootstrap daemon. #2662
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2662 +/- ##
==========================================
+ Coverage 73.69% 73.72% +0.02%
==========================================
Files 148 148
Lines 30479 30479
==========================================
+ Hits 22461 22470 +9
+ Misses 8018 8009 -9 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @iphydf)
other/bootstrap_daemon/src/config.c
line 82 at r1 (raw file):
Previously, iphydf wrote…
I'm actually not certain about this. It seems to me that this realloc always resizes down? Why do we do this at all?
Yep, it always downsizes, and yes, it is not really necessary. The array is short-lived, it's freed in the main()
after passing the ports to new_tcp_server()
, before entering the main loop, so this is a rather pointless attempt at memory optimization.
Feel free to remove it. The same for the similar realloc blow.
Found by PVS Studio.
9a36d44
to
08d3393
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 1 approvals obtained
other/bootstrap_daemon/src/config.c
line 82 at r1 (raw file):
Previously, nurupo wrote…
Yep, it always downsizes, and yes, it is not really necessary. The array is short-lived, it's freed in the
main()
after passing the ports tonew_tcp_server()
, before entering the main loop, so this is a rather pointless attempt at memory optimization.Feel free to remove it. The same for the similar realloc blow.
Done.
Found by PVS Studio.
This change is