From d7f0700c2271e4916c5735d3e02944364c37a29b Mon Sep 17 00:00:00 2001 From: Eric Branlund Date: Tue, 3 Dec 2019 20:36:04 -0800 Subject: [PATCH] Plugged memory leak in autopick_autoregister(). --- src/autopick.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/autopick.c b/src/autopick.c index 960f10ba..501dcbe6 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -1901,6 +1901,7 @@ bool autopick_autoregister(object_type *o_ptr) char pref_file[1024]; FILE *pref_fff; autopick_type an_entry, *entry = &an_entry; + concptr tmp; int match_autopick = is_autopick(o_ptr); @@ -2023,7 +2024,9 @@ bool autopick_autoregister(object_type *o_ptr) /* Add a line to the file */ /* Don't kill "entry" */ - fprintf(pref_fff, "%s\n", autopick_line_from_entry(entry)); + tmp = autopick_line_from_entry(entry); + fprintf(pref_fff, "%s\n", tmp); + string_free(tmp); fclose(pref_fff); return TRUE; -- 2.21.0 (Apple Git-122.2)