diff --git a/CHANGELOG b/CHANGELOG index cad49f3ef..509ffb15b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o Fixed one of the memory leaks in getpts_simple which occures when + no ports are to be added to 'list'. 'porttbl' is now free'd regardless + of how the function returns. + o Fixed a bug in the showOwner NSE script which caused it to try UDP ports instead of just TCP ports. This made it very slow in the common case where there are many UDP ports in the open|filtered diff --git a/nmap.cc b/nmap.cc index bb4986a40..926bf6ffd 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2147,8 +2147,10 @@ void getpts_simple(const char *origexpr, int range_type, (*count)++; } - if (*count == 0) + if (*count == 0){ + free(porttbl); return; + } *list = (unsigned short *) safe_zalloc(*count * sizeof(unsigned short));