tccgen: fix inline_functions double free fix
This commit is contained in:
25
tccpp.c
25
tccpp.c
@ -1072,11 +1072,17 @@ ST_FUNC int *tok_str_dup(TokenString *s)
|
||||
return str;
|
||||
}
|
||||
|
||||
ST_FUNC void tok_str_free(int *str)
|
||||
ST_FUNC void tok_str_free_str(int *str)
|
||||
{
|
||||
tal_free(tokstr_alloc, str);
|
||||
}
|
||||
|
||||
ST_FUNC void tok_str_free(TokenString *str)
|
||||
{
|
||||
tok_str_free_str(str->str);
|
||||
tal_free(tokstr_alloc, str);
|
||||
}
|
||||
|
||||
ST_FUNC int *tok_str_realloc(TokenString *s, int new_size)
|
||||
{
|
||||
int *str, size;
|
||||
@ -1123,8 +1129,7 @@ ST_FUNC void end_macro(void)
|
||||
if (str->alloc == 2) {
|
||||
str->alloc = 3; /* just mark as finished */
|
||||
} else {
|
||||
tok_str_free(str->str);
|
||||
tal_free(tokstr_alloc, str);
|
||||
tok_str_free(str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1328,7 +1333,7 @@ ST_FUNC void free_defines(Sym *b)
|
||||
while (define_stack != b) {
|
||||
Sym *top = define_stack;
|
||||
define_stack = top->prev;
|
||||
tok_str_free(top->d);
|
||||
tok_str_free_str(top->d);
|
||||
define_undef(top);
|
||||
sym_free(top);
|
||||
}
|
||||
@ -3138,10 +3143,10 @@ static int macro_subst_tok(
|
||||
for (i = 0; i < ws_str.len; i++)
|
||||
tok_str_add(tok_str, ws_str.str[i]);
|
||||
}
|
||||
tok_str_free(ws_str.str);
|
||||
tok_str_free_str(ws_str.str);
|
||||
return 0;
|
||||
} else {
|
||||
tok_str_free(ws_str.str);
|
||||
tok_str_free_str(ws_str.str);
|
||||
}
|
||||
next_nomacro(); /* eat '(' */
|
||||
|
||||
@ -3208,7 +3213,7 @@ static int macro_subst_tok(
|
||||
sa = args;
|
||||
while (sa) {
|
||||
sa1 = sa->prev;
|
||||
tok_str_free(sa->d);
|
||||
tok_str_free_str(sa->d);
|
||||
sym_free(sa);
|
||||
sa = sa1;
|
||||
}
|
||||
@ -3223,7 +3228,7 @@ static int macro_subst_tok(
|
||||
*nested_list = sa1->prev;
|
||||
sym_free(sa1);
|
||||
if (mstr != s->d)
|
||||
tok_str_free(mstr);
|
||||
tok_str_free_str(mstr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -3400,7 +3405,7 @@ no_subst:
|
||||
}
|
||||
}
|
||||
if (macro_str1)
|
||||
tok_str_free(macro_str1);
|
||||
tok_str_free_str(macro_str1);
|
||||
|
||||
}
|
||||
|
||||
@ -3542,7 +3547,7 @@ ST_FUNC void tccpp_delete(TCCState *s)
|
||||
/* free static buffers */
|
||||
cstr_free(&tokcstr);
|
||||
cstr_free(&cstr_buf);
|
||||
tok_str_free(tokstr_buf.str);
|
||||
tok_str_free_str(tokstr_buf.str);
|
||||
|
||||
/* free allocators */
|
||||
tal_delete(toksym_alloc);
|
||||
|
||||
Reference in New Issue
Block a user