aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2019-07-02 03:51:13 +0200
committerMichael Meskes <meskes@postgresql.org>2019-07-08 08:30:31 +0200
commit58006f8041fffc9260b92fc2cb3a571aaa6c6d22 (patch)
tree923fb9f6294e340d505bff4c52209d30154774d4 /src
parentcf665ad4c89eb9b20285dc04aec906d46ed810d2 (diff)
downloadpostgresql-58006f8041fffc9260b92fc2cb3a571aaa6c6d22.tar.gz
postgresql-58006f8041fffc9260b92fc2cb3a571aaa6c6d22.zip
Fix small memory leak in ecpglib ecpg_update_declare_statement() is called the
second time. Author: "Zhang, Jie" <zhangjie2@cn.fujitsu.com>
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 0dcf736390b..6edff5c0c0d 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -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);
+ }
}
/*