]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/http: ensure uri_path is freed for POST
authorTomas Krizek <tomas.krizek@nic.cz>
Thu, 7 Jan 2021 12:35:21 +0000 (13:35 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 7 Jan 2021 12:49:45 +0000 (13:49 +0100)
Since #636 was implemented, uri_path is also saved for POST requests and
thus needs to be freed.

daemon/http.c

index 944d21a3049020bdad793ad00202bbe04f5d029e..7e52b8dfd4dd54a2f65b36e3183e11b30d16b27b 100644 (file)
@@ -387,11 +387,11 @@ static int on_frame_recv_callback(nghttp2_session *h2, const nghttp2_frame *fram
                        if (process_uri_path(ctx, ctx->uri_path, stream_id) < 0) {
                                refuse_stream(h2, stream_id);
                        }
-                       free(ctx->uri_path);
-                       ctx->uri_path = NULL;
                }
                ctx->incomplete_stream = -1;
                ctx->current_method = HTTP_METHOD_NONE;
+               free(ctx->uri_path);
+               ctx->uri_path = NULL;
 
                len = ctx->buf_pos - sizeof(uint16_t);
                if (len <= 0 || len > KNOT_WIRE_MAX_PKTSIZE) {