Skip to content

http2, push headers cleanup - #13054

Closed
icing wants to merge 3 commits into
curl:masterfrom
icing:h2-push-headers
Closed

icing wants to merge 3 commits into
curl:masterfrom
icing:h2-push-headers

Conversation

@icing

@icing icing commented Mar 6, 2024

Copy link
Copy Markdown
Contributor
  • provide common cleanup method for push headers

- provide common cleanup method for push headers
Comment thread lib/http2.c Outdated

@danielgustafsson danielgustafsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@bagder

bagder commented Mar 6, 2024

Copy link
Copy Markdown
Member

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

icing commented Mar 6, 2024

Copy link
Copy Markdown
Contributor Author

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.

3 participants