ecpg: Fix rare memory leaks
authorPeter Eisentraut <[email protected]>
Thu, 8 Mar 2012 20:21:12 +0000 (22:21 +0200)
committerPeter Eisentraut <[email protected]>
Sat, 10 Mar 2012 23:01:22 +0000 (01:01 +0200)
found by Coverity

src/interfaces/ecpg/ecpglib/execute.c

index 2fb54392c9e80f12086d46e313143111215aec11..3f1478694de91ba0f91519948bf5c87fc2d7349e 100644 (file)
@@ -1776,6 +1776,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);
        }
@@ -1807,6 +1808,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);
        }