Skip to content

Commit 66cb6cd

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix Soap leaking http_msg on error
2 parents e8b73c4 + a9dada2 commit 66cb6cd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ PHP NEWS
8080
. Fixed bug GH-15711 (SoapClient can't convert BackedEnum to scalar value).
8181
(nielsdos)
8282
. Fixed bug GH-16237 (Segmentation fault when cloning SoapServer). (nielsdos)
83+
. Fix Soap leaking http_msg on error. (nielsdos)
8384

8485
- SPL:
8586
. Fixed bug GH-15918 (Assertion failure in ext/spl/spl_fixedarray.c).

ext/soap/php_http.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ int make_http_soap_request(zval *this_ptr,
461461
}
462462
add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL);
463463
smart_str_free(&soap_headers_z);
464+
efree(http_msg);
464465
return FALSE;
465466
}
466467

@@ -474,6 +475,7 @@ int make_http_soap_request(zval *this_ptr,
474475
}
475476
add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL);
476477
smart_str_free(&soap_headers_z);
478+
efree(http_msg);
477479
return FALSE;
478480
}
479481

@@ -487,6 +489,7 @@ int make_http_soap_request(zval *this_ptr,
487489
add_soap_fault(this_ptr, "HTTP", "SSL support is not available in this build", NULL, NULL);
488490
PG(allow_url_fopen) = old_allow_url_fopen;
489491
smart_str_free(&soap_headers_z);
492+
efree(http_msg);
490493
return FALSE;
491494
}
492495

@@ -541,6 +544,7 @@ int make_http_soap_request(zval *this_ptr,
541544
add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL);
542545
PG(allow_url_fopen) = old_allow_url_fopen;
543546
smart_str_free(&soap_headers_z);
547+
efree(http_msg);
544548
return FALSE;
545549
}
546550
}
@@ -684,6 +688,7 @@ int make_http_soap_request(zval *this_ptr,
684688
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
685689
smart_str_free(&soap_headers_z);
686690
smart_str_free(&soap_headers);
691+
efree(http_msg);
687692
return FALSE;
688693
}
689694

@@ -901,12 +906,14 @@ int make_http_soap_request(zval *this_ptr,
901906
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
902907
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL);
903908
smart_str_free(&soap_headers_z);
909+
efree(http_msg);
904910
return FALSE;
905911
}
906912
smart_str_free(&soap_headers);
907913
} else {
908914
add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", NULL, NULL);
909915
smart_str_free(&soap_headers_z);
916+
efree(http_msg);
910917
return FALSE;
911918
}
912919

@@ -915,6 +922,7 @@ int make_http_soap_request(zval *this_ptr,
915922
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
916923
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
917924
smart_str_free(&soap_headers_z);
925+
efree(http_msg);
918926
return TRUE;
919927
}
920928

@@ -929,6 +937,7 @@ int make_http_soap_request(zval *this_ptr,
929937
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
930938
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL);
931939
smart_str_free(&soap_headers_z);
940+
efree(http_msg);
932941
return FALSE;
933942
}
934943

@@ -1157,6 +1166,7 @@ int make_http_soap_request(zval *this_ptr,
11571166
if (--redirect_max < 1) {
11581167
add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting", NULL, NULL);
11591168
smart_str_free(&soap_headers_z);
1169+
efree(http_msg);
11601170
return FALSE;
11611171
}
11621172

0 commit comments

Comments
 (0)