From 484de1a72825f6d8ce5934e4400726fe6469410d Mon Sep 17 00:00:00 2001 From: Eric Branlund Date: Fri, 8 Nov 2024 16:43:45 -0700 Subject: [PATCH] Plug memory leak for early return parsing player_timed --- src/player-timed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/player-timed.c b/src/player-timed.c index 10db4f74b..e00972e00 100644 --- a/src/player-timed.c +++ b/src/player-timed.c @@ -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); @@ -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;