Skip to content

Fix Soap leaking http_msg on error #16254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ int make_http_soap_request(zval *this_ptr,
}
add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL);
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}

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

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

Expand Down Expand Up @@ -541,6 +544,7 @@ int make_http_soap_request(zval *this_ptr,
add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL);
PG(allow_url_fopen) = old_allow_url_fopen;
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}
}
Expand Down Expand Up @@ -684,6 +688,7 @@ int make_http_soap_request(zval *this_ptr,
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
smart_str_free(&soap_headers_z);
smart_str_free(&soap_headers);
efree(http_msg);
return FALSE;
}

Expand Down Expand Up @@ -901,12 +906,14 @@ int make_http_soap_request(zval *this_ptr,
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL);
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}
smart_str_free(&soap_headers);
} else {
add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", NULL, NULL);
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}

Expand All @@ -915,6 +922,7 @@ int make_http_soap_request(zval *this_ptr,
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
smart_str_free(&soap_headers_z);
efree(http_msg);
return TRUE;
}

Expand All @@ -929,6 +937,7 @@ int make_http_soap_request(zval *this_ptr,
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL);
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}

Expand Down Expand Up @@ -1157,6 +1166,7 @@ int make_http_soap_request(zval *this_ptr,
if (--redirect_max < 1) {
add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting", NULL, NULL);
smart_str_free(&soap_headers_z);
efree(http_msg);
return FALSE;
}

Expand Down
Loading