commit fef5aab80857bfb1472157b07261028759571021
parent 6554bfd2c1bfaa67e6357b2a2589adaf47347a25
Author: Florian Dold <dold@taler.net>
Date: Sun, 9 Aug 2026 19:23:34 +0200
http: fix response header cleanup
Diffstat:
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/quickjs/quickjs-http.c b/quickjs/quickjs-http.c
@@ -62,13 +62,9 @@ struct CurlRequestState {
// Must only be called with locked client mutex
static void destroy_curl_request_state(struct CurlRequestState *crs)
{
- struct CurlClientState *ccs;
-
if (!crs) {
return;
}
- ccs = crs->ccs;
- crs->ccs = NULL;
list_del(&crs->link_req);
curl_slist_free_all(crs->req_headers);
@@ -100,7 +96,6 @@ handle_done(CURL *curl, CURLcode res)
if (CURLE_OK == res) {
int num_headers = 0;
int i;
- char **headers;
struct curl_slist *sl = crs->resp_headers;
char *url = NULL;
@@ -157,12 +152,7 @@ done:
crs->response_cb(crs->response_cb_cls, &hri);
}
- if (NULL != headers) {
- for (char **h=headers; *h; h++) {
- free(*h);
- }
- free(headers);
- }
+ free(headers);
pthread_mutex_lock(&ccs->mutex);
destroy_curl_request_state(crs);
pthread_mutex_unlock(&ccs->mutex);
@@ -204,8 +194,6 @@ create_impl(void *cls, struct JSHttpRequestInfo *req_info)
{
struct CurlClientState *ccs = cls;
struct CurlRequestState *crs;
- pthread_t thread;
- int res;
CURL *curl;
BOOL debug = req_info->debug > 0;
const char *method = req_info->method;
@@ -532,4 +520,3 @@ js_curl_http_client_destroy(struct JSHttpClientImplementation *impl)
impl->cls = NULL;
free(impl);
}
-