Skip to content

Commit 2e468aa

Browse files
committed
Fix core dump in error path of plpgsql_parse_tripwordtype. Somebody
introduced a copy-and-pasteo while trying to simplify the code.
1 parent 07044f5 commit 2e468aa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/pl/plpgsql/src/pl_comp.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.96 2005/11/22 18:17:33 momjian Exp $
6+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.97 2005/12/09 17:08:49 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -1316,25 +1316,25 @@ plpgsql_parse_dblwordtype(char *word)
13161316
0, 0, 0);
13171317
if (!HeapTupleIsValid(classtup))
13181318
goto done;
1319+
classStruct = (Form_pg_class) GETSTRUCT(classtup);
13191320

13201321
/*
13211322
* It must be a relation, sequence, view, or type
13221323
*/
1323-
classStruct = (Form_pg_class) GETSTRUCT(classtup);
13241324
if (classStruct->relkind != RELKIND_RELATION &&
13251325
classStruct->relkind != RELKIND_SEQUENCE &&
13261326
classStruct->relkind != RELKIND_VIEW &&
13271327
classStruct->relkind != RELKIND_COMPOSITE_TYPE)
13281328
goto done;
13291329

13301330
/*
1331-
* Fetch the named table field and it's type
1331+
* Fetch the named table field and its type
13321332
*/
13331333
attrtup = SearchSysCacheAttName(classOid, cp[1]);
13341334
if (!HeapTupleIsValid(attrtup))
13351335
goto done;
1336-
13371336
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
1337+
13381338
typetup = SearchSysCache(TYPEOID,
13391339
ObjectIdGetDatum(attrStruct->atttypid),
13401340
0, 0, 0);
@@ -1373,10 +1373,10 @@ plpgsql_parse_tripwordtype(char *word)
13731373
{
13741374
Oid classOid;
13751375
HeapTuple classtup = NULL;
1376-
Form_pg_class classStruct;
13771376
HeapTuple attrtup = NULL;
1378-
Form_pg_attribute attrStruct;
13791377
HeapTuple typetup = NULL;
1378+
Form_pg_class classStruct;
1379+
Form_pg_attribute attrStruct;
13801380
char *cp[2];
13811381
char *colname[1];
13821382
int qualified_att_len;
@@ -1421,26 +1421,26 @@ plpgsql_parse_tripwordtype(char *word)
14211421
0, 0, 0);
14221422
if (!HeapTupleIsValid(classtup))
14231423
goto done;
1424+
classStruct = (Form_pg_class) GETSTRUCT(classtup);
14241425

14251426
/*
14261427
* It must be a relation, sequence, view, or type
14271428
*/
1428-
classStruct = (Form_pg_class) GETSTRUCT(classtup);
14291429
if (classStruct->relkind != RELKIND_RELATION &&
14301430
classStruct->relkind != RELKIND_SEQUENCE &&
14311431
classStruct->relkind != RELKIND_VIEW &&
14321432
classStruct->relkind != RELKIND_COMPOSITE_TYPE)
14331433
goto done;
14341434

14351435
/*
1436-
* Fetch the named table field and it's type
1436+
* Fetch the named table field and its type
14371437
*/
14381438
plpgsql_convert_ident(cp[1], colname, 1);
14391439
attrtup = SearchSysCacheAttName(classOid, colname[0]);
14401440
if (!HeapTupleIsValid(attrtup))
14411441
goto done;
1442-
14431442
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
1443+
14441444
typetup = SearchSysCache(TYPEOID,
14451445
ObjectIdGetDatum(attrStruct->atttypid),
14461446
0, 0, 0);
@@ -1459,7 +1459,7 @@ plpgsql_parse_tripwordtype(char *word)
14591459
done:
14601460
if (HeapTupleIsValid(classtup))
14611461
ReleaseSysCache(classtup);
1462-
if (HeapTupleIsValid(classtup))
1462+
if (HeapTupleIsValid(attrtup))
14631463
ReleaseSysCache(attrtup);
14641464
if (HeapTupleIsValid(typetup))
14651465
ReleaseSysCache(typetup);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy