-
Notifications
You must be signed in to change notification settings - Fork 861
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
Replace exit() with the new exit_tcpdump(), which calls smiExit() #535
Replace exit() with the new exit_tcpdump(), which calls smiExit() #535
Conversation
…xit() (if compiled with smi option)
{ | ||
|
||
#ifdef USE_LIBSMI | ||
smiExit(); |
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.
The smi_config man page doesn't say what happens if you call smiExit()
without having called smiInit()
, so you might want to have a static smiInit_called
flag in tcpdump.c
, set it after calling smiInit()
if smiInit()
returns 0 (meaning "success"), and only call smiExit()
if it's non-zero.
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.
Please use tabs - or 8 spaces - for indentation, for consistency with the rest of the code.
It seems to me the code in |
@infrastation : Thanks for alerting. Without past-knowledge or complete overview of the project, it is quite possible I am missing something.
|
You are right, tcpdump currently compiles all the source files in as that has been the traditional way. As far as I understand, it was intended to switch tcpdump to link with Other developers may have a better understanding of this. |
OK, I've done it differently in 91e08f8. libnetdissect now has |
Thanks @guyharris , @infrastation. Given my beginner status in the project, reviewing your series of patches is beyond my knowledge at this point. |
Thank you Guy. @bijalthanawala, if you would like to study a useful feature request that is well documented but not implemented, try looking at #480, #415, #296 and the-tcpdump-group/libpcap#127. |
Thanks @infrastation |
As suggested by @guyharris here - #529:
New function exit_tcpdump(), which calls smiExit()(if USE_LIBSMI is defined), introduced.
All calls to exit(), including the one in utils.c:error() replaced with call to this new function.
smiExit() is leaking one memory allocation, which libsmi team has been informed of along
with some preliminary investigation report and offer to assist.
Before calling smiExit():
After calling smiExit():