Added missing braces to prevent a segfault after usage of an undeclared cursor.
authorMichael Meskes <[email protected]>
Mon, 26 Jun 2006 14:13:04 +0000 (14:13 +0000)
committerMichael Meskes <[email protected]>
Mon, 26 Jun 2006 14:13:04 +0000 (14:13 +0000)
src/interfaces/ecpg/preproc/preproc.y

index 5a9a50b8ce887542def57ab28dbd63735537cd77..e7cfefb3627760c38761fc3078357ecd992130d6 100644 (file)
@@ -292,6 +292,7 @@ add_additional_variables(char *name, bool insert)
                mmerror(PARSE_ERROR, ET_ERROR, "trying to access an undeclared cursor %s\n", name);
                return NULL;
        }
+
        if (insert)
        {
                /* add all those input variables that were given earlier 
@@ -811,8 +812,10 @@ stmt:  AlterDatabaseSetStmt                { output_statement($1, 0, connection); }
                        struct cursor *ptr;
 
                        if ((ptr = add_additional_variables($1, true)) != NULL)
+                       {
                                output_statement(mm_strdup(ptr->command), 0, ptr->connection ? mm_strdup(ptr->connection) : NULL);
-                       ptr->opened = true;
+                               ptr->opened = true;
+                       }
                }
                | ECPGPrepare
                {