Fixed some memory leaks in ECPG.
Patch by Michael Paquier
This commit is contained in:
parent
82be1bf509
commit
96ad72d1c0
|
@ -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;
|
||||||
|
|
||||||
|
@ -550,6 +550,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,11 +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 = mm_strdup("0");
|
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:
|
||||||
|
|
Loading…
Reference in New Issue