Content-Length: 338104 | pFad | http://github.com/postgrespro/postgres_cluster/commit/8cf82ac53e9a3d5dd86f16106e3398063a526817

3A Ecpglib stores variables that are used in DECLARE statements in a glo… · postgrespro/postgres_cluster@8cf82ac · GitHub
Skip to content

Commit 8cf82ac

Browse files
author
Michael Meskes
committed
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
1 parent dfd26f9 commit 8cf82ac

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ ecpg_finish(struct connection * act)
149149
for (cache = act->cache_head; cache; ptr = cache, cache = cache->next, ecpg_free(ptr));
150150
ecpg_free(act->name);
151151
ecpg_free(act);
152+
/* delete cursor variables when last connection gets closed */
153+
if (all_connections == NULL)
154+
{
155+
struct var_list *iv_ptr;
156+
157+
for (; ivlist; iv_ptr = ivlist, ivlist = ivlist->next, ecpg_free(iv_ptr));
158+
}
152159
}
153160
else
154161
ecpg_log("ecpg_finish: called an extra time\n");

src/interfaces/ecpg/ecpglib/extern.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ struct variable
121121
struct variable *next;
122122
};
123123

124+
struct var_list
125+
{
126+
int number;
127+
void *pointer;
128+
struct var_list *next;
129+
};
130+
131+
extern struct var_list *ivlist;
132+
124133
/* Here are some methods used by the lib. */
125134

126135
/* Returns a pointer to a string containing a simple type name. */

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,7 @@ ecpg_gettext(const char *msgid)
501501
}
502502
#endif /* ENABLE_NLS */
503503

504-
static struct var_list
505-
{
506-
int number;
507-
void *pointer;
508-
struct var_list *next;
509-
} *ivlist = NULL;
504+
struct var_list *ivlist = NULL;
510505

511506
void
512507
ECPGset_var(int number, void *pointer, int lineno)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/8cf82ac53e9a3d5dd86f16106e3398063a526817

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy