Skip to content

Commit 7439d48

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #78665: Multicasting may leak memory
2 parents 74ac3dd + 900bdcb commit 7439d48

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
. Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
1212
cmb).
1313

14+
- Sockets:
15+
. Fixed bug #78665 (Multicasting may leak memory). (cmb)
16+
1417
24 Oct 2019, PHP 7.3.11
1518

1619
- Core:

ext/sockets/multicast.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
646646
goto retry;
647647
}
648648
if (retval != NO_ERROR) {
649+
efree(addr_table);
649650
php_error_docref(NULL, E_WARNING,
650651
"GetIpAddrTable failed with error %lu", retval);
651652
return FAILURE;
@@ -654,9 +655,11 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
654655
MIB_IPADDRROW r = addr_table->table[i];
655656
if (r.dwIndex == if_index) {
656657
out_addr->s_addr = r.dwAddr;
658+
efree(addr_table);
657659
return SUCCESS;
658660
}
659661
}
662+
efree(addr_table);
660663
php_error_docref(NULL, E_WARNING,
661664
"No interface with index %u was found", if_index);
662665
return FAILURE;
@@ -686,6 +689,7 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
686689
goto retry;
687690
}
688691
if (retval != NO_ERROR) {
692+
efree(addr_table);
689693
php_error_docref(NULL, E_WARNING,
690694
"GetIpAddrTable failed with error %lu", retval);
691695
return FAILURE;
@@ -694,9 +698,11 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
694698
MIB_IPADDRROW r = addr_table->table[i];
695699
if (r.dwAddr == addr->s_addr) {
696700
*if_index = r.dwIndex;
701+
efree(addr_table);
697702
return SUCCESS;
698703
}
699704
}
705+
efree(addr_table);
700706

701707
{
702708
char addr_str[17] = {0};

0 commit comments

Comments
 (0)