From d1809abf361ee7b15c5ab1caff92001827f9dd1e Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 8 Feb 2024 21:58:05 +0200 Subject: [PATCH 1/2] http: do not double free scry cache path --- pkg/vere/io/http.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index b5cb1d12cb..4027de02e3 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -714,7 +714,6 @@ _http_cache_scry_cb(void* vod_p, u3_noun nun) } u3h_put(htd_u->nax_p, peq_u->pax, nun); - u3z(peq_u->pax); c3_free(peq_u); } From 29e1972518a5fdb3d599623d4f89a05f38a314e5 Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Thu, 8 Feb 2024 23:10:58 +0200 Subject: [PATCH 2/2] http: fix the double free problem in a nicer way --- pkg/vere/io/http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index 4027de02e3..6fb607ad5c 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -714,6 +714,7 @@ _http_cache_scry_cb(void* vod_p, u3_noun nun) } u3h_put(htd_u->nax_p, peq_u->pax, nun); + u3z(peq_u->pax); c3_free(peq_u); } @@ -728,6 +729,8 @@ _http_req_cache(u3_hreq* req_u) u3_noun url = u3dc("scot", 't', _http_vec_to_atom(req_u->rec_u->path)); u3_weak sac = u3h_get(htd_u->sax_p, url); + u3z(url); + if ( u3_none == sac ) { return c3n; } @@ -738,7 +741,7 @@ _http_req_cache(u3_hreq* req_u) req_u->peq_u = c3_malloc(sizeof(*req_u->peq_u)); req_u->peq_u->req_u = req_u; req_u->peq_u->htd_u = htd_u; - req_u->peq_u->pax = sac; + req_u->peq_u->pax = u3k(sac); req_u->sat_e = u3_rsat_peek;