mirror of
https://github.com/postgres/postgres.git
synced 2025-06-01 14:21:49 +03:00
Fixed some memory leaks in ECPG.
Patch by Michael Paquier Conflicts: src/interfaces/ecpg/preproc/variable.c
This commit is contained in:
parent
1ea539ae3f
commit
ec311b1d8f
@ -175,6 +175,7 @@ output_get_descr(char *desc_name, char *index)
|
|||||||
for (results = assignments; results != NULL; results = results->next)
|
for (results = assignments; results != NULL; results = results->next)
|
||||||
{
|
{
|
||||||
const struct variable *v = find_variable(results->variable);
|
const struct variable *v = find_variable(results->variable);
|
||||||
|
char *str_zero = mm_strdup("0");
|
||||||
|
|
||||||
switch (results->value)
|
switch (results->value)
|
||||||
{
|
{
|
||||||
@ -188,7 +189,8 @@ output_get_descr(char *desc_name, char *index)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(yyout, "%s,", get_dtype(results->value));
|
fprintf(yyout, "%s,", get_dtype(results->value));
|
||||||
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, mm_strdup("0"), NULL, NULL);
|
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
|
||||||
|
free(str_zero);
|
||||||
}
|
}
|
||||||
drop_assignments();
|
drop_assignments();
|
||||||
fputs("ECPGd_EODT);\n", yyout);
|
fputs("ECPGd_EODT);\n", yyout);
|
||||||
@ -292,8 +294,12 @@ output_set_descr(char *desc_name, char *index)
|
|||||||
case ECPGd_indicator:
|
case ECPGd_indicator:
|
||||||
case ECPGd_length:
|
case ECPGd_length:
|
||||||
case ECPGd_type:
|
case ECPGd_type:
|
||||||
fprintf(yyout, "%s,", get_dtype(results->value));
|
{
|
||||||
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, mm_strdup("0"), NULL, NULL);
|
char *str_zero = mm_strdup("0");
|
||||||
|
fprintf(yyout, "%s,", get_dtype(results->value));
|
||||||
|
ECPGdump_a_type(yyout, v->name, v->type, v->brace_level, NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
|
||||||
|
free(str_zero);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
||||||
static int xcdepth = 0; /* depth of nesting in slash-star comments */
|
static int xcdepth = 0; /* depth of nesting in slash-star comments */
|
||||||
static char *dolqstart; /* current $foo$ quote start string */
|
static char *dolqstart = NULL; /* current $foo$ quote start string */
|
||||||
static YY_BUFFER_STATE scanbufhandle;
|
static YY_BUFFER_STATE scanbufhandle;
|
||||||
static char *scanbuf;
|
static char *scanbuf;
|
||||||
|
|
||||||
@ -525,6 +525,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
|
|||||||
}
|
}
|
||||||
<SQL>{dolqdelim} {
|
<SQL>{dolqdelim} {
|
||||||
token_start = yytext;
|
token_start = yytext;
|
||||||
|
if (dolqstart)
|
||||||
|
free(dolqstart);
|
||||||
dolqstart = mm_strdup(yytext);
|
dolqstart = mm_strdup(yytext);
|
||||||
BEGIN(xdolq);
|
BEGIN(xdolq);
|
||||||
startlit();
|
startlit();
|
||||||
|
@ -437,9 +437,13 @@ remove_variable_from_list(struct arguments ** list, struct variable * var)
|
|||||||
void
|
void
|
||||||
dump_variables(struct arguments * list, int mode)
|
dump_variables(struct arguments * list, int mode)
|
||||||
{
|
{
|
||||||
|
char *str_zero;
|
||||||
|
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
str_zero = mm_strdup("0");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The list is build up from the beginning so lets first dump the end of
|
* The list is build up from the beginning so lets first dump the end of
|
||||||
* the list:
|
* the list:
|
||||||
@ -450,11 +454,13 @@ dump_variables(struct arguments * list, int mode)
|
|||||||
/* Then the current element and its indicator */
|
/* Then the current element and its indicator */
|
||||||
ECPGdump_a_type(yyout, list->variable->name, list->variable->type, list->variable->brace_level,
|
ECPGdump_a_type(yyout, list->variable->name, list->variable->type, list->variable->brace_level,
|
||||||
list->indicator->name, list->indicator->type, list->indicator->brace_level,
|
list->indicator->name, list->indicator->type, list->indicator->brace_level,
|
||||||
NULL, NULL, mm_strdup("0"), NULL, NULL);
|
NULL, NULL, str_zero, NULL, NULL);
|
||||||
|
|
||||||
/* Then release the list element. */
|
/* Then release the list element. */
|
||||||
if (mode != 0)
|
if (mode != 0)
|
||||||
free(list);
|
free(list);
|
||||||
|
|
||||||
|
free(str_zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user