-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix SEGFAULT on early exit with IPv6 enabled #97
Conversation
Some command line options, like e.g -V, will cause conserver to exit before the IPv6 address variables are initialized. Avoid the calls to freeaddrinfo() in these cases. Signed-off-by: Bjørn Mork <bjorn@mork.no>
Add pending patch, fixing a crash when conserver exits without starting the server. Link: bstansell/conserver#97 Signed-off-by: Bjørn Mork <bjorn@mork.no>
Add pending patch, fixing a crash when conserver exits without starting the server. Link: bstansell/conserver#97 Signed-off-by: Bjørn Mork <bjorn@mork.no>
Add pending patch, fixing a crash when conserver exits without starting the server. Link: bstansell/conserver#97 Signed-off-by: Bjørn Mork <bjorn@mork.no>
struct addrinfo *bindAddr; | ||
struct addrinfo *bindBaseAddr; | ||
struct addrinfo *bindAddr = (struct addrinfo *)0; | ||
struct addrinfo *bindBaseAddr = (struct addrinfo *)0; |
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.
This change is unnecessary. These are globals, and have "static storage duration" and thus are already guaranteed to be initialized to NULL.
In section 3.5.7 of the C89 drafts available onliine:
"If an object that has static storage duration is not initialized explicitly, it is initialized implicitly as if every member that has arithmetic type were assigned 0 and every member that has pointer type were assigned a null pointer constant. "
@@ -781,8 +781,10 @@ DestroyDataStructures(void) | |||
|
|||
#if USE_IPV6 | |||
/* clean up addrinfo stucts */ | |||
freeaddrinfo(bindAddr); | |||
freeaddrinfo(bindBaseAddr); | |||
if ((struct addrinfo *)0 != bindAddr) |
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.
you don't need the casts. A NULL or 0 in pointer context can be compared against a pointer of any type. See C89 section 3.2.2.3.
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.
Yes, sure. Just trying my best to match the existing code style.
Add pending patch, fixing a crash when conserver exits without starting the server. Link: bstansell/conserver#97 Signed-off-by: Bjørn Mork <bjorn@mork.no>
Some command line options, like e.g -V, will cause conserver to exit before the IPv6 address variables are initialized. Avoid the calls to freeaddrinfo() in these cases.