mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
fix double release for stable pointers
This commit is contained in:
@@ -812,6 +812,9 @@ PgfType PgfExprParser::parse_type()
|
|||||||
size_t n_hypos = 0;
|
size_t n_hypos = 0;
|
||||||
PgfTypeHypo *hypos = NULL;
|
PgfTypeHypo *hypos = NULL;
|
||||||
|
|
||||||
|
size_t n_types = 0;
|
||||||
|
PgfType *types = NULL;
|
||||||
|
|
||||||
PgfText *cat = NULL;
|
PgfText *cat = NULL;
|
||||||
|
|
||||||
size_t n_args = 0;
|
size_t n_args = 0;
|
||||||
@@ -851,6 +854,9 @@ PgfType PgfExprParser::parse_type()
|
|||||||
if (type == 0)
|
if (type == 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
types = (PgfType*) realloc(types, sizeof(PgfType)*(n_types+1));
|
||||||
|
types[n_types++] = type;
|
||||||
|
|
||||||
if (token_tag != PGF_TOKEN_RPAR)
|
if (token_tag != PGF_TOKEN_RPAR)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
@@ -891,6 +897,9 @@ PgfType PgfExprParser::parse_type()
|
|||||||
bt->type = u->dtyp(0,NULL,cat,n_args,args);
|
bt->type = u->dtyp(0,NULL,cat,n_args,args);
|
||||||
n_hypos++;
|
n_hypos++;
|
||||||
|
|
||||||
|
types = (PgfType*) realloc(types, sizeof(PgfType)*(n_types+1));
|
||||||
|
types[n_types++] = bt->type;
|
||||||
|
|
||||||
while (n_args > 0) {
|
while (n_args > 0) {
|
||||||
u->free_ref(args[--n_args]);
|
u->free_ref(args[--n_args]);
|
||||||
}
|
}
|
||||||
@@ -909,11 +918,16 @@ PgfType PgfExprParser::parse_type()
|
|||||||
exit:
|
exit:
|
||||||
while (n_hypos > 0) {
|
while (n_hypos > 0) {
|
||||||
PgfTypeHypo *hypo = &hypos[--n_hypos];
|
PgfTypeHypo *hypo = &hypos[--n_hypos];
|
||||||
u->free_ref(hypo->type);
|
|
||||||
free(hypo->cid);
|
free(hypo->cid);
|
||||||
}
|
}
|
||||||
free(hypos);
|
free(hypos);
|
||||||
|
|
||||||
|
while (n_types > 0) {
|
||||||
|
PgfType type = types[--n_types];
|
||||||
|
u->free_ref(type);
|
||||||
|
}
|
||||||
|
free(types);
|
||||||
|
|
||||||
free(cat);
|
free(cat);
|
||||||
|
|
||||||
while (n_args > 0) {
|
while (n_args > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user