From 24bc59f5c2d1f0d20ed37c3060d9dfad48800526 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 13 May 2014 18:06:09 +0000 Subject: [PATCH] Freeing the lists with functions and shortcuts upon exit. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4872 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/global.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 79df0f13..2419e681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * src/text.c (do_linter): Make an error message somewhat clearer. * src/rcfile.c (parse_binding): Improve another error message. * doc/syntax/nanorc.nanorc: Show key names like M-6 and M-/ as valid. + * src/global.c (thanks_for_all_the_fish): Upon exit also free the + lists with functions and shortcuts. 2014-05-12 Benno Schulenberg * src/text.c (do_spell): Provide startup feedback, as for the linter. diff --git a/src/global.c b/src/global.c index 6430c343..29592387 100644 --- a/src/global.c +++ b/src/global.c @@ -666,7 +666,7 @@ void shortcut_init(void) while (allfuncs != NULL) { subnfunc *f = allfuncs; - allfuncs = (allfuncs)->next; + allfuncs = allfuncs->next; free(f); } @@ -1681,6 +1681,17 @@ void thanks_for_all_the_fish(void) if (replaceage != NULL) free_filestruct(replaceage); #endif + /* Free the functions and shortcuts lists. */ + while (allfuncs != NULL) { + subnfunc *f = allfuncs; + allfuncs = allfuncs->next; + free(f); + } + while (sclist != NULL) { + subnfunc *f = sclist; + sclist = sclist->next; + free(f); + } #ifndef DISABLE_NANORC if (homedir != NULL) free(homedir); -- 2.39.5