]> granicus.if.org Git - postgresql/commitdiff
Fix thinko in new ECPG "PREPARE AS" code.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 26 May 2019 14:06:37 +0000 (10:06 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 26 May 2019 14:06:37 +0000 (10:06 -0400)
ecpg_register_prepared_stmt() is pretty obviously checking the wrong
variable while trying to detect malloc failure.  Error in commit
a1dc6ab46, spotted by Coverity.

src/interfaces/ecpg/ecpglib/prepare.c

index fa9d74b80dc58bccf96eff806e17f2d4b888dd72..0dcf736390bd7d4e60ca2eab8ad7af49f5573af8 100644 (file)
@@ -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;