From a544b605e25cf4dc8e107a697b8cc28c8132e125 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 29 Dec 1997 05:13:57 +0000 Subject: [PATCH] Change some mallocs to palloc. --- src/backend/commands/explain.c | 6 +++--- src/backend/executor/nodeAgg.c | 4 ++-- src/backend/parser/analyze.c | 5 ++--- src/backend/parser/parse_node.c | 4 ++-- src/backend/utils/adt/acl.c | 8 +++----- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 5c2c1a2859..2d90ce4858 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.15 1997/11/25 21:58:53 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.16 1997/12/29 05:13:22 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -68,7 +68,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest) if (plan == NULL) return; - es = (ExplainState *) malloc(sizeof(ExplainState)); + es = (ExplainState *) palloc(sizeof(ExplainState)); MemSet(es, 0, sizeof(ExplainState)); es->printCost = true; /* default */ @@ -103,7 +103,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest) elog(NOTICE, "%.*s", ELOG_MAXLEN - 64, s); len -= ELOG_MAXLEN - 64; } - free(es); + pfree(es); } /***************************************************************************** diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 5b6b180cb9..59c18ab158 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -266,11 +266,11 @@ ExecAgg(Agg *node) tupValue = projInfo->pi_tupValue; /* initially, set all the values to NULL */ - null_array = malloc(tupType->natts); + null_array = palloc(tupType->natts); for (i = 0; i < tupType->natts; i++) null_array[i] = 'n'; oneTuple = heap_formtuple(tupType, tupValue, null_array); - free(null_array); + pfree(null_array); } break; } diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 5837fa8fb7..38be671962 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.59 1997/12/29 04:31:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.60 1997/12/29 05:13:35 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,7 +51,6 @@ List *extras = NIL; * Returns a list of transformed parse trees. Optimizable statements are * all transformed to Query while the rest stays the same. * - * CALLER is responsible for freeing the QueryTreeList* returned */ QueryTreeList * parse_analyze(List *pl) @@ -82,7 +81,7 @@ parse_analyze(List *pl) pl = lnext(pl); if (pstate->p_target_relation != NULL) heap_close(pstate->p_target_relation); - free(pstate); + pfree(pstate); } return result; diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 90e182cb71..d77df5a998 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.3 1997/11/26 03:42:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.4 1997/12/29 05:13:46 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ make_parsestate(void) { ParseState *pstate; - pstate = malloc(sizeof(ParseState)); + pstate = palloc(sizeof(ParseState)); pstate->p_last_resno = 1; pstate->p_rtable = NIL; pstate->p_numAgg = 0; diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 05a298e4ea..f855c6caba 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.20 1997/11/24 05:08:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.21 1997/12/29 05:13:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -580,7 +580,6 @@ aclcontains(Acl *acl, AclItem *aip) * * does not add duplicate privileges * - * the CALLER is reponsible for free'ing the string returned */ char * @@ -591,7 +590,7 @@ aclmakepriv(char *old_privlist, char new_priv) int l; Assert(strlen(old_privlist) < 5); - priv = malloc(5); /* at most "rwaR" */ ; + priv = palloc(5); /* at most "rwaR" */ ; if (old_privlist == NULL || old_privlist[0] == '\0') { @@ -634,7 +633,6 @@ aclmakepriv(char *old_privlist, char new_priv) * * this routine is used in the parser * - * the CALLER is responsible for freeing the memory allocated */ char * @@ -642,7 +640,7 @@ aclmakeuser(char *user_type, char *user) { char *user_list; - user_list = malloc(strlen(user) + 3); + user_list = palloc(strlen(user) + 3); sprintf(user_list, "%s %s", user_type, user); return user_list; } -- 2.40.0