From: Tom Lane Date: Sun, 26 May 2019 14:06:37 +0000 (-0400) Subject: Fix thinko in new ECPG "PREPARE AS" code. X-Git-Tag: REL_12_BETA2~109 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=331695a4d9ca40864240aca721dc588a206ff395;p=postgresql Fix thinko in new ECPG "PREPARE AS" code. ecpg_register_prepared_stmt() is pretty obviously checking the wrong variable while trying to detect malloc failure. Error in commit a1dc6ab46, spotted by Coverity. --- diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c index fa9d74b80d..0dcf736390 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -85,7 +85,7 @@ ecpg_register_prepared_stmt(struct statement *stmt) return false; prep_stmt = (struct statement *) ecpg_alloc(sizeof(struct statement), lineno); - if (!stmt) + if (!prep_stmt) { ecpg_free(this); return false;