Skip to content
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

http2, push headers cleanup #13054

Closed
wants to merge 3 commits into from
Closed

http2, push headers cleanup #13054

wants to merge 3 commits into from

Conversation

icing
Copy link
Contributor

@icing icing commented Mar 6, 2024

  • provide common cleanup method for push headers

- provide common cleanup method for push headers
lib/http2.c Outdated Show resolved Hide resolved
Copy link
Member

@danielgustafsson danielgustafsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bagder
Copy link
Member

bagder commented Mar 6, 2024

I think it also needs this:

diff --git a/lib/http2.c b/lib/http2.c
index 2112545c5..725ec742c 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1431,14 +1431,14 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
         failf(data_s, "Too many PUSH_PROMISE headers");
         free_push_headers(stream);
         return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
       }
       stream->push_headers_alloc *= 2;
-      headp = Curl_saferealloc(stream->push_headers,
-                               stream->push_headers_alloc * sizeof(char *));
+      headp = realloc(stream->push_headers,
+                      stream->push_headers_alloc * sizeof(char *));
       if(!headp) {
-        stream->push_headers = NULL;
+        free_push_headers(stream);
         return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
       }
       stream->push_headers = headp;
     }
     h = aprintf("%s:%s", name, value);

@icing
Copy link
Contributor Author

icing commented Mar 6, 2024

I think it also needs this:

Correct. Just added it. Thanks for finding.

@bagder bagder closed this in deca803 Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants