!1657 【轻量级 PR】:修复mxid_to_string在TopMemoryContext分配内存的问题

Merge pull request !1657 from chenxiaobin/N/A
This commit is contained in:
opengauss-bot 2022-04-01 07:59:00 +00:00 committed by Gitee
commit 02c14696bf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 5 deletions

View File

@ -1278,13 +1278,10 @@ static const char *MXStatusToString(MultiXactStatus status)
static char *mxid_to_string(MultiXactId multi, int nmembers, MultiXactMember *members)
{
static char *str = NULL;
char *str = NULL;
StringInfoData buf;
int i;
if (str != NULL)
pfree(str);
initStringInfo(&buf);
appendStringInfo(&buf, XID_FMT " %d[" XID_FMT " (%s)", multi, nmembers,
@ -1295,7 +1292,7 @@ static char *mxid_to_string(MultiXactId multi, int nmembers, MultiXactMember *me
}
appendStringInfoChar(&buf, ']');
str = MemoryContextStrdup(TopMemoryContext, buf.data);
str = MemoryContextStrdup(SESS_GET_MEM_CXT_GROUP(MEMORY_CONTEXT_STORAGE), buf.data);
pfree(buf.data);
return str;
}