ecpg: Fix rare memory leaks
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 8 Mar 2012 20:21:12 +0000 (22:21 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 10 Mar 2012 23:01:48 +0000 (01:01 +0200)
found by Coverity

src/interfaces/ecpg/ecpglib/execute.c

index 1e11209890c33474a9a77a1e1821861faa5a63c6..8ad671e70a09922a1539e1e519d5abe7182cd323 100644 (file)
@@ -1777,6 +1777,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
                {
                        setlocale(LC_NUMERIC, oldlocale);
                        ecpg_free(oldlocale);
+                       free_statement(stmt);
                        va_end(args);
                        return (false);
                }
@@ -1808,6 +1809,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
                        ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt->command);
                        setlocale(LC_NUMERIC, oldlocale);
                        ecpg_free(oldlocale);
+                       free_statement(stmt);
                        va_end(args);
                        return (false);
                }