Skip to content

Commit 4b98d42

Browse files
author
Michael Meskes
committed
Added missing braces to prevent a segfault after usage of an undeclared cursor.
1 parent 6bf44d5 commit 4b98d42

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,5 +2035,10 @@ Mo Jun 26 11:05:25 CEST 2006
20352035

20362036
- Added some more coverity report patches send in by Joachim Wieland
20372037
<joe@mcknight.de>.
2038+
2039+
Mo Jun 26 16:08:23 CEST 2006
2040+
2041+
- Added missing braces to prevent a segfault after usage of an
2042+
undeclared cursor.
20382043
- Set ecpg library version to 5.2.
20392044
- Set ecpg version to 4.2.1.

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.324 2006/06/06 11:31:55 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.325 2006/06/26 14:12:02 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -292,6 +292,7 @@ add_additional_variables(char *name, bool insert)
292292
mmerror(PARSE_ERROR, ET_ERROR, "trying to access an undeclared cursor %s\n", name);
293293
return NULL;
294294
}
295+
295296
if (insert)
296297
{
297298
/* add all those input variables that were given earlier
@@ -837,9 +838,11 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, connection); }
837838
struct cursor *ptr;
838839

839840
if ((ptr = add_additional_variables($1, true)) != NULL)
841+
{
840842
output_statement(mm_strdup(ptr->command), 0,
841843
ptr->connection ? mm_strdup(ptr->connection) : NULL);
842-
ptr->opened = true;
844+
ptr->opened = true;
845+
}
843846
}
844847
| ECPGPrepare
845848
{

0 commit comments

Comments
 (0)