Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita544b60

Browse files
committed
Change some mallocs to palloc.
1 parenta1dd409 commita544b60

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

‎src/backend/commands/explain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.15 1997/11/25 21:58:53 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.16 1997/12/29 05:13:22 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -68,7 +68,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
6868
if (plan==NULL)
6969
return;
7070

71-
es= (ExplainState*)malloc(sizeof(ExplainState));
71+
es= (ExplainState*)palloc(sizeof(ExplainState));
7272
MemSet(es,0,sizeof(ExplainState));
7373

7474
es->printCost= true;/* default */
@@ -103,7 +103,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
103103
elog(NOTICE,"%.*s",ELOG_MAXLEN-64,s);
104104
len-=ELOG_MAXLEN-64;
105105
}
106-
free(es);
106+
pfree(es);
107107
}
108108

109109
/*****************************************************************************

‎src/backend/executor/nodeAgg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ ExecAgg(Agg *node)
266266
tupValue=projInfo->pi_tupValue;
267267

268268
/* initially, set all the values to NULL */
269-
null_array=malloc(tupType->natts);
269+
null_array=palloc(tupType->natts);
270270
for (i=0;i<tupType->natts;i++)
271271
null_array[i]='n';
272272
oneTuple=heap_formtuple(tupType,tupValue,null_array);
273-
free(null_array);
273+
pfree(null_array);
274274
}
275275
break;
276276
}

‎src/backend/parser/analyze.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.59 1997/12/2904:31:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.60 1997/12/2905:13:35 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -51,7 +51,6 @@ List *extras = NIL;
5151
* Returns a list of transformed parse trees. Optimizable statements are
5252
* all transformed to Query while the rest stays the same.
5353
*
54-
* CALLER is responsible for freeing the QueryTreeList* returned
5554
*/
5655
QueryTreeList*
5756
parse_analyze(List*pl)
@@ -82,7 +81,7 @@ parse_analyze(List *pl)
8281
pl=lnext(pl);
8382
if (pstate->p_target_relation!=NULL)
8483
heap_close(pstate->p_target_relation);
85-
free(pstate);
84+
pfree(pstate);
8685
}
8786

8887
returnresult;

‎src/backend/parser/parse_node.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.3 1997/11/26 03:42:44 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.4 1997/12/29 05:13:46 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@ make_parsestate(void)
4646
{
4747
ParseState*pstate;
4848

49-
pstate=malloc(sizeof(ParseState));
49+
pstate=palloc(sizeof(ParseState));
5050
pstate->p_last_resno=1;
5151
pstate->p_rtable=NIL;
5252
pstate->p_numAgg=0;

‎src/backend/utils/adt/acl.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.20 1997/11/24 05:08:54 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.21 1997/12/29 05:13:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -580,7 +580,6 @@ aclcontains(Acl *acl, AclItem *aip)
580580
*
581581
* does not add duplicate privileges
582582
*
583-
* the CALLER is reponsible for free'ing the string returned
584583
*/
585584

586585
char*
@@ -591,7 +590,7 @@ aclmakepriv(char *old_privlist, char new_priv)
591590
intl;
592591

593592
Assert(strlen(old_privlist)<5);
594-
priv=malloc(5);/* at most "rwaR" */ ;
593+
priv=palloc(5);/* at most "rwaR" */ ;
595594

596595
if (old_privlist==NULL||old_privlist[0]=='\0')
597596
{
@@ -634,15 +633,14 @@ aclmakepriv(char *old_privlist, char new_priv)
634633
*
635634
* this routine is used in the parser
636635
*
637-
* the CALLER is responsible for freeing the memory allocated
638636
*/
639637

640638
char*
641639
aclmakeuser(char*user_type,char*user)
642640
{
643641
char*user_list;
644642

645-
user_list=malloc(strlen(user)+3);
643+
user_list=palloc(strlen(user)+3);
646644
sprintf(user_list,"%s %s",user_type,user);
647645
returnuser_list;
648646
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp