Fix misplaced strdup(), which could lead to error messages referencing
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 6 Jan 2001 01:39:01 +0000 (01:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 6 Jan 2001 01:39:01 +0000 (01:39 +0000)
deallocated memory later on.

src/pl/plpgsql/src/gram.y

index 8251d71908ef8791a2e0bc20ca242a87ef42678a..ed1704276e9deb8fd790d0eb818b79f9dd4e3a70 100644 (file)
@@ -4,7 +4,7 @@
  *           procedural language
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.12 2000/09/05 09:02:18 wieck Exp $
+ *    $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.13 2001/01/06 01:39:01 tgl Exp $
  *
  *    This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -378,13 +378,15 @@ decl_rowtype  : T_ROW
 
 decl_varname   : T_WORD
            {
-               $$.name = plpgsql_tolower(strdup(yytext));
-           $$.lineno  = yylineno;
+               /* name should be malloc'd for use as varname */
+               $$.name = strdup(plpgsql_tolower(yytext));
+               $$.lineno  = yylineno;
            }
        ;
 
 decl_renname   : T_WORD
            {
+               /* the result must be palloc'd, see plpgsql_ns_rename */
                $$ = plpgsql_tolower(yytext);
            }
        ;