Skip to content

Commit

Permalink
allocate guc values in cache context
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Dec 5, 2024
1 parent 845a984 commit ddc1a3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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++;
}
Expand Down

0 comments on commit ddc1a3f

Please sign in to comment.