Skip to content
Draft
Show file tree
Hide file tree
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
11 changes: 3 additions & 8 deletions ext/uri/php_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,7 @@ static void uri_unserialize(INTERNAL_FUNCTION_PARAMETERS, const char *uri_parser

uri_internal_t *internal_uri = uri_internal_from_obj(object);
internal_uri->parser = uri_parser_by_name(uri_parser_name, strlen(uri_parser_name));
if (internal_uri->uri != NULL) {
internal_uri->parser->free_uri(internal_uri->uri);
}
internal_uri->parser->free_uri(internal_uri->uri);
internal_uri->uri = internal_uri->parser->parse_uri(Z_STRVAL_P(uri_zv), Z_STRLEN_P(uri_zv), NULL, NULL, true);
if (internal_uri->uri == NULL) {
zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object", ZSTR_VAL(object->ce->name));
Expand Down Expand Up @@ -970,11 +968,8 @@ static void uri_free_obj_handler(zend_object *object)
{
uri_object_t *uri_object = uri_object_from_obj(object);

if (UNEXPECTED(uri_object->internal.uri != NULL)) {
uri_object->internal.parser->free_uri(uri_object->internal.uri);
uri_object->internal.parser = NULL;
uri_object->internal.uri = NULL;
}
uri_object->internal.parser->free_uri(uri_object->internal.uri);
uri_object->internal.uri = NULL;

zend_object_std_dtor(&uri_object->std);
}
Expand Down
4 changes: 4 additions & 0 deletions ext/uri/uri_parser_php_parse_url.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ static void uri_parser_php_parse_url_free(void *uri)
{
php_url *parse_url_uri = uri;

if (UNEXPECTED(parse_url_uri == NULL)) {
return;
}

php_url_free(parse_url_uri);
}

Expand Down
6 changes: 5 additions & 1 deletion ext/uri/uri_parser_rfc3986.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,14 @@ ZEND_ATTRIBUTE_NONNULL static zend_string *php_uri_parser_rfc3986_to_string(void
return uri_string;
}

ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_rfc3986_free(void *uri)
static void php_uri_parser_rfc3986_free(void *uri)
{
php_uri_parser_rfc3986_uris *uriparser_uris = uri;

if (UNEXPECTED(uriparser_uris == NULL)) {
return;
}

uriFreeUriMembersMmA(&uriparser_uris->uri, mm);
uriFreeUriMembersMmA(&uriparser_uris->normalized_uri, mm);

Expand Down
Loading