]> granicus.if.org Git - postgresql/commitdiff
Fix small memory leak in ecpglib ecpg_update_declare_statement() is called the
authorMichael Meskes <meskes@postgresql.org>
Tue, 2 Jul 2019 01:51:13 +0000 (03:51 +0200)
committerMichael Meskes <meskes@postgresql.org>
Wed, 3 Jul 2019 01:17:06 +0000 (03:17 +0200)
second time.

Author: "Zhang, Jie" <zhangjie2@cn.fujitsu.com>

src/interfaces/ecpg/ecpglib/prepare.c

index 0dcf736390bd7d4e60ca2eab8ad7af49f5573af8..6edff5c0c0dcb65ca45dfee5e7e4acceb8acc8f4 100644 (file)
@@ -754,7 +754,11 @@ ecpg_update_declare_statement(const char *declared_name, const char *cursor_name
        /* Find the declared node by declared name */
        p = ecpg_find_declared_statement(declared_name);
        if (p)
+       {
+               if (p->cursor_name)
+                       ecpg_free(p->cursor_name);
                p->cursor_name = ecpg_strdup(cursor_name, lineno);
+       }
 }
 
 /*