Commit 8cf82ac5 authored by Michael Meskes's avatar Michael Meskes

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
parent dfd26f9c
...@@ -149,6 +149,13 @@ ecpg_finish(struct connection * act) ...@@ -149,6 +149,13 @@ ecpg_finish(struct connection * act)
for (cache = act->cache_head; cache; ptr = cache, cache = cache->next, ecpg_free(ptr)); for (cache = act->cache_head; cache; ptr = cache, cache = cache->next, ecpg_free(ptr));
ecpg_free(act->name); ecpg_free(act->name);
ecpg_free(act); 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 else
ecpg_log("ecpg_finish: called an extra time\n"); ecpg_log("ecpg_finish: called an extra time\n");
......
...@@ -121,6 +121,15 @@ struct variable ...@@ -121,6 +121,15 @@ struct variable
struct variable *next; struct variable *next;
}; };
struct var_list
{
int number;
void *pointer;
struct var_list *next;
};
extern struct var_list *ivlist;
/* Here are some methods used by the lib. */ /* Here are some methods used by the lib. */
/* Returns a pointer to a string containing a simple type name. */ /* Returns a pointer to a string containing a simple type name. */
......
...@@ -501,12 +501,7 @@ ecpg_gettext(const char *msgid) ...@@ -501,12 +501,7 @@ ecpg_gettext(const char *msgid)
} }
#endif /* ENABLE_NLS */ #endif /* ENABLE_NLS */
static struct var_list struct var_list *ivlist = NULL;
{
int number;
void *pointer;
struct var_list *next;
} *ivlist = NULL;
void void
ECPGset_var(int number, void *pointer, int lineno) ECPGset_var(int number, void *pointer, int lineno)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment