Skip to content

Commit 586f851

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78665: Multicasting may leak memory
2 parents db54b0f + 7439d48 commit 586f851

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
@@ -38,6 +38,9 @@ PHP NEWS
3838
. Fixed bug #75245 (Don't set content of elements with only whitespaces).
3939
(eriklundin)
4040

41+
- Sockets:
42+
. Fixed bug #78665 (Multicasting may leak memory). (cmb)
43+
4144
- Standard:
4245
. Fixed bug #76859 (stream_get_line skips data if used with data-generating
4346
filter). (kkopachev)

ext/sockets/multicast.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
648648
goto retry;
649649
}
650650
if (retval != NO_ERROR) {
651+
efree(addr_table);
651652
php_error_docref(NULL, E_WARNING,
652653
"GetIpAddrTable failed with error %lu", retval);
653654
return FAILURE;
@@ -656,9 +657,11 @@ int php_if_index_to_addr4(unsigned if_index, php_socket *php_sock, struct in_add
656657
MIB_IPADDRROW r = addr_table->table[i];
657658
if (r.dwIndex == if_index) {
658659
out_addr->s_addr = r.dwAddr;
660+
efree(addr_table);
659661
return SUCCESS;
660662
}
661663
}
664+
efree(addr_table);
662665
php_error_docref(NULL, E_WARNING,
663666
"No interface with index %u was found", if_index);
664667
return FAILURE;
@@ -688,6 +691,7 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
688691
goto retry;
689692
}
690693
if (retval != NO_ERROR) {
694+
efree(addr_table);
691695
php_error_docref(NULL, E_WARNING,
692696
"GetIpAddrTable failed with error %lu", retval);
693697
return FAILURE;
@@ -696,9 +700,11 @@ int php_add4_to_if_index(struct in_addr *addr, php_socket *php_sock, unsigned *i
696700
MIB_IPADDRROW r = addr_table->table[i];
697701
if (r.dwAddr == addr->s_addr) {
698702
*if_index = r.dwIndex;
703+
efree(addr_table);
699704
return SUCCESS;
700705
}
701706
}
707+
efree(addr_table);
702708

703709
{
704710
char addr_str[17] = {0};

0 commit comments

Comments
 (0)