free stringinfo

Offering: openGaussDev

More detail: free stringinfo

Match-id-195105d1af600164d70fa568cb3890550bf70e9f
This commit is contained in:
openGaussDev 2022-03-04 16:09:31 +08:00 committed by yanghao
parent d28a571efd
commit 90e7a6b7f6
3 changed files with 16 additions and 5 deletions

View File

@ -2509,6 +2509,8 @@ char* getObjectDescription(const ObjectAddress* object)
initStringInfo(&buffer);
char* signature = NULL;
switch (getObjectClass(object)) {
case OCLASS_CLASS:
getRelationDescription(&buffer, object->objectId);
@ -2518,11 +2520,15 @@ char* getObjectDescription(const ObjectAddress* object)
break;
case OCLASS_PROC:
appendStringInfo(&buffer, _("function %s"), format_procedure(object->objectId));
signature = format_procedure(object->objectId);
appendStringInfo(&buffer, _("function %s"), signature);
pfree_ext(signature);
break;
case OCLASS_PACKAGE:
appendStringInfo(&buffer, _("package %s"), format_procedure(object->objectId));
signature = format_procedure(object->objectId);
appendStringInfo(&buffer, _("package %s"), signature);
pfree_ext(signature);
break;
case OCLASS_TYPE:
@ -2776,7 +2782,7 @@ char* getObjectDescription(const ObjectAddress* object)
initStringInfo(&opfam);
getOpFamilyDescription(&opfam, amprocForm->amprocfamily);
signature = format_procedure(amprocForm->amproc);
/* ------
translator: %d is the function number, the first two %s's
are data type names, the third %s is the description of the
@ -2788,8 +2794,9 @@ char* getObjectDescription(const ObjectAddress* object)
format_type_be(amprocForm->amproclefttype),
format_type_be(amprocForm->amprocrighttype),
opfam.data,
format_procedure(amprocForm->amproc));
signature);
pfree_ext(signature);
pfree_ext(opfam.data);
systable_endscan(amscan);

View File

@ -285,6 +285,7 @@ Oid RangeVarGetRelidExtended(const RangeVar* relation, LOCKMODE lockmode, bool m
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("temporary tables cannot specify a schema name")));
}
pfree_ext(errDetail);
errDetail = get_relname_relid_extend(
relation->relname, u_sess->catalog_cxt.myTempNamespace, &relId, isSupportSynonym, refSynOid);
}
@ -293,6 +294,7 @@ Oid RangeVarGetRelidExtended(const RangeVar* relation, LOCKMODE lockmode, bool m
/* use exact schema given */
namespaceId = LookupExplicitNamespace(relation->schemaname);
pfree_ext(errDetail);
errDetail = get_relname_relid_extend(relation->relname, namespaceId, &relId, isSupportSynonym, refSynOid);
if (OidIsValid(relId) && namespaceId == u_sess->catalog_cxt.myTempNamespace)
@ -300,6 +302,7 @@ Oid RangeVarGetRelidExtended(const RangeVar* relation, LOCKMODE lockmode, bool m
} else {
/* search the namespace path */
if (isSupportSynonym) {
pfree_ext(errDetail);
errDetail = RelnameGetRelidExtended(relation->relname, &relId, refSynOid, detailInfo);
} else {
relId = RelnameGetRelid(relation->relname, detailInfo);
@ -419,8 +422,8 @@ Oid RangeVarGetRelidExtended(const RangeVar* relation, LOCKMODE lockmode, bool m
/* Skipping report error, but store the error detail info and report later. */
appendStringInfo(detailInfo, _("%s"), errDetail);
}
pfree_ext(errDetail);
}
pfree_ext(errDetail);
if (!OidIsValid(relId) && !missing_ok) {
if (relation->schemaname)

View File

@ -7082,6 +7082,7 @@ void RemoveTempNamespace()
u_sess->catalog_cxt.myTempToastNamespace = InvalidOid;
}
}
pfree_ext(str.data);
}
PG_CATCH();
{