Skip to content

Commit

Permalink
Plug memory leak for early return parsing player_timed
Browse files Browse the repository at this point in the history
  • Loading branch information
backwardsEric authored and NickMcConnell committed Nov 9, 2024
1 parent a42e10c commit 484de1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/player-timed.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ static enum parser_error parse_player_timed_change_grade(struct parser *p)
{
struct timed_effect_data *t = parser_priv(p);
struct timed_change_grade *current = t->c_grade;
struct timed_change_grade *l = mem_zalloc(sizeof(*l));
const char *color = parser_getsym(p, "color");
int grade_max = parser_getint(p, "max");
struct timed_change_grade *l;
int attr;

assert(t);
Expand All @@ -315,6 +315,7 @@ static enum parser_error parse_player_timed_change_grade(struct parser *p)
}

/* Add the new one */
l = mem_zalloc(sizeof(*l));
current->next = l;
l->c_grade = current->c_grade + 1;

Expand Down

0 comments on commit 484de1a

Please sign in to comment.