]> granicus.if.org Git - postgresql/commitdiff
In ecpglib restore LC_NUMERIC in case of an error.
authorMichael Meskes <meskes@postgresql.org>
Thu, 1 Sep 2011 13:27:38 +0000 (15:27 +0200)
committerMichael Meskes <meskes@postgresql.org>
Thu, 1 Sep 2011 13:31:16 +0000 (15:31 +0200)
src/interfaces/ecpg/ecpglib/execute.c

index 1019bfe62012442be326079dd9b4c27d266e9056..589c57dffa831571d080edc37c70120a5eaf98a6 100644 (file)
@@ -1773,8 +1773,12 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
         */
        if (statement_type == ECPGst_prepnormal)
        {
-               if (!ecpg_auto_prepare(lineno, connection_name, compat, &prepname, query))
+               if (!ecpg_auto_prepare(lineno, connection_name, compat, &prepname, query)) {
+                       setlocale(LC_NUMERIC, oldlocale);
+                       ecpg_free(oldlocale);
+                       va_end(args);
                        return (false);
+               }
 
                /*
                 * statement is now prepared, so instead of the query we have to
@@ -1801,6 +1805,9 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
                else
                {
                        ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command);
+                       setlocale(LC_NUMERIC, oldlocale);
+                       ecpg_free(oldlocale);
+                       va_end(args);
                        return (false);
                }
        }