Skip to content

Commit

Permalink
Fix #78665: Multicasting may leak memory
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed Oct 12, 2019
1 parent 46561da commit 900bdcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ PHP NEWS
. Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
cmb).

- Sockets:
. Fixed bug #78665 (Multicasting may leak memory). (cmb)

24 Oct 2019, PHP 7.2.24

- Core:
Expand Down
6 changes: 6 additions & 0 deletions ext/sockets/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
goto retry;
}
if (retval != NO_ERROR) {
efree(addr_table);
php_error_docref(NULL, E_WARNING,
"GetIpAddrTable failed with error %lu", retval);
return FAILURE;
Expand All @@ -660,9 +661,11 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
MIB_IPADDRROW r = addr_table->table[i];
if (r.dwIndex == if_index) {
out_addr->s_addr = r.dwAddr;
efree(addr_table);
return SUCCESS;
}
}
efree(addr_table);
php_error_docref(NULL, E_WARNING,
"No interface with index %u was found", if_index);
return FAILURE;
Expand Down Expand Up @@ -692,6 +695,7 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
goto retry;
}
if (retval != NO_ERROR) {
efree(addr_table);
php_error_docref(NULL, E_WARNING,
"GetIpAddrTable failed with error %lu", retval);
return FAILURE;
Expand All @@ -700,9 +704,11 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
MIB_IPADDRROW r = addr_table->table[i];
if (r.dwAddr == addr->s_addr) {
*if_index = r.dwIndex;
efree(addr_table);
return SUCCESS;
}
}
efree(addr_table);

{
char addr_str[17] = {0};
Expand Down

0 comments on commit 900bdcb

Please sign in to comment.