luigi1809 / webfilter-ng

Transparent HTTP/HTTPS/TLS web filter
GNU Lesser General Public License v3.0
37 stars 11 forks source link

How about malloc pointer #12

Closed whitetiger21022014 closed 4 years ago

whitetiger21022014 commented 4 years ago

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,

luigi1809 commented 4 years ago

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

whitetiger21022014 commented 4 years ago

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;

luigi1809 commented 4 years ago

Fixed in https://github.com/luigi1809/webfilter-ng/pull/13