Skip to content

Commit

Permalink
fix memory leak in raise error.
Browse files Browse the repository at this point in the history
  • Loading branch information
soasme committed Feb 15, 2021
1 parent 609c7b4 commit 104f356
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions peppapeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ P4_NeedLift(P4_Source* s, P4_Expression* e) {
P4_PRIVATE(void)
P4_RaiseError(P4_Source* s, P4_Error err, P4_String errmsg) {
s->err = err;

if (s->errmsg != NULL)
free(s->errmsg);

s->errmsg = strdup(errmsg);
/*
size_t len = strlen(errmsg)+10;
Expand Down

0 comments on commit 104f356

Please sign in to comment.