Skip to content

Commit

Permalink
free orig ast if we made a copy in lookup_nominal
Browse files Browse the repository at this point in the history
  • Loading branch information
mfelsche committed Sep 27, 2018
1 parent 3c67411 commit 0854cca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libponyc/type/lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,17 @@ static deferred_reification_t* lookup_nominal(pass_opt_t* opt, ast_t* from,

ast_t* typeargs = ast_childidx(type, 2);

ast_t* orig_initial = orig;
if(ast_id(find) == TK_FUN && ast_id(ast_child(find)) == TK_BOX)
orig = downcast_iso_trn_receiver_to_ref(orig);

return deferred_reify_new(find, typeparams, typeargs, orig);
deferred_reification_t* reified = deferred_reify_new(find, typeparams, typeargs, orig);

// free if we made a copy of orig
if(orig != orig_initial)
ast_free(orig);

return reified;
}

static deferred_reification_t* lookup_typeparam(pass_opt_t* opt, ast_t* from,
Expand Down

0 comments on commit 0854cca

Please sign in to comment.