Skip to content

Commit 1ced4ac

Browse files
committed
Fix lifetime of mtm_log_gucs desc string.
I checked that full_name is copied, but didn't pay attention that desc isn't, which is strange.
1 parent 57939b2 commit 1ced4ac

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/multimaster.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -691,13 +691,14 @@ NULL);
691691
for (i = 0; mtm_log_gucs[i].name; i++)
692692
{
693693
MtmLogGuc *guc = &mtm_log_gucs[i];
694-
char full_name[128];
695-
char desc[128];
696-
697-
snprintf(full_name, sizeof(full_name),
698-
"multimaster.%s_log_level", guc->name);
699-
snprintf(desc, sizeof(desc),
700-
"log level for %s multimaster messages", guc->name);
694+
char *full_name;
695+
char *desc;
696+
MemoryContext oldcontext;
697+
698+
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
699+
full_name = psprintf("multimaster.%s_log_level", guc->name);
700+
desc = psprintf("log level for %s multimaster messages", guc->name);
701+
MemoryContextSwitchTo(oldcontext);
701702
DefineCustomEnumVariable(
702703
full_name,
703704
desc,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy