fix: Correct a few potential null derefs in bootstrap daemon.#2662
fix: Correct a few potential null derefs in bootstrap daemon.#2662iphydf merged 1 commit intoTokTok:masterfrom
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. |
nurupo
left a comment
There was a problem hiding this comment.
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
iphydf
left a comment
There was a problem hiding this comment.
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