diff options
author | Michael Meskes <meskes@postgresql.org> | 2012-01-05 14:08:45 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2012-01-05 14:08:45 +0100 |
commit | 8cf82ac53e9a3d5dd86f16106e3398063a526817 (patch) | |
tree | b176e03222f8ad171d8a35b1e468149e989ab9f0 /src/interfaces/ecpg/ecpglib/connect.c | |
parent | dfd26f9c5f371437f243249025863ea9911aacaa (diff) | |
download | postgresql-8cf82ac53e9a3d5dd86f16106e3398063a526817.tar.gz postgresql-8cf82ac53e9a3d5dd86f16106e3398063a526817.zip |
Ecpglib stores variables that are used in DECLARE statements in a global list.
This list is now freed when the last connection has been closed.
Closes: #6366
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/connect.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 997046b38b7..909ba700920 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -149,6 +149,13 @@ ecpg_finish(struct connection * act) for (cache = act->cache_head; cache; ptr = cache, cache = cache->next, ecpg_free(ptr)); ecpg_free(act->name); ecpg_free(act); + /* delete cursor variables when last connection gets closed */ + if (all_connections == NULL) + { + struct var_list *iv_ptr; + + for (; ivlist; iv_ptr = ivlist, ivlist = ivlist->next, ecpg_free(iv_ptr)); + } } else ecpg_log("ecpg_finish: called an extra time\n"); |