From ddc1a3f41e88081c5c86fd4169a7a65f0393293b Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 5 Dec 2024 12:58:52 -0800 Subject: [PATCH] allocate guc values in cache context --- http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 6f4bab0..68626c9 100644 --- a/http.c +++ b/http.c @@ -318,8 +318,10 @@ static char * guc_strdup(int elevel, const char *src) { char *data; - + MemoryContext oldcontext = MemoryContextSwitchTo(CacheMemoryContext); data = pstrdup(src); + MemoryContextSwitchTo(oldcontext); + if (data == NULL) ereport(elevel, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -981,7 +983,7 @@ Datum http_reset_curlopt(PG_FUNCTION_ARGS) /* Clean out the settable_curlopts global cache */ while (opt->curlopt) { - if (opt->curlopt_val) pfree(opt->curlopt_val); + if (opt->curlopt_val) guc_free(opt->curlopt_val); opt->curlopt_val = NULL; opt++; }