luigi1809/webfilter-ng

How about malloc pointer

whitetiger21022014 opened this issue · 3 comments

Thank for your code
In your code there are 11 malloc lines for memory, but do not have any free
Do you think it can cause memory leak?
BRs,

Thank you for opening this issue.
Yes, you are correct. The issue is not severe but needs a fix for sure.
Feel free to do a pull request

I think, just change from return webGuard(..) to ret_bool = webGuard(...)
example in function check_packet_against_hostname(...)

*bool check_packet_against_hostname(const unsigned char packet)
bool ret_bool = true;
.................
ret_bool = webGuard(...)
if (uri) free(uri);
if (host) free(host);
goto end;
...............

end:
if (saddr) free(saddr);
if (daddr) free(daddr);
return ret_bool;

Fixed in #13