From 154136a7cbb8c64d18a1c5a3b62cbf45bcb56f2c Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Wed, 23 Feb 2011 03:09:23 +0000 Subject: [PATCH] 2011-02-22 Chris Allegretta * color.c (nfreeregex): Fix that we were trying to set the pointer passed by value to NULL. Fixes crashes on file save reported by Ken Tyler and Matthieu Lejeune. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4532 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 6 +++++- src/color.c | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9653a93f..eb8c4324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-02-22 Chris Allegretta + * color.c (nfreeregex): Fix that we were trying to set the pointer passed by value + to NULL. Fixes crashes on file save reported by Ken Tyler and Matthieu Lejeune. + 2011-02-18 Chris Allegretta * New saved cursor position history option. Command line option -P or --poslog, rc file entry "poslog". Search history changes to ~/.nano/search_history, cursor position log @@ -7,7 +11,7 @@ 4.15 discussing the change and offering an interoperability workaround. * files.c (load_history): Set last_search to the last search value we loaded from history, so do_research will succeed without needing to manually load the last seach in. Fixes - bug reported by Matt "ML" at gmail. + bug reported by Matthieu Lejeune. 2011-02-12 Chris Allegretta * Initial libmagic implementation, adapted from Eitan Adler . diff --git a/src/color.c b/src/color.c index 580fcaa0..f98ad068 100644 --- a/src/color.c +++ b/src/color.c @@ -108,13 +108,13 @@ void color_init(void) } /* Cleanup a regex we previously compiled */ -void nfreeregex(regex_t *r) +void nfreeregex(regex_t **r) { assert(r != NULL); - regfree(r); - free(r); - r = NULL; + regfree(*r); + free(*r); + *r = NULL; } /* Update the color information based on the current filename. */ @@ -219,7 +219,7 @@ void color_update(void) /* Decompile e->ext_regex's specified regex if we aren't * going to use it. */ if (not_compiled) - nfreeregex(e->ext); + nfreeregex(&e->ext); } } @@ -251,7 +251,7 @@ void color_update(void) } if (not_compiled) - nfreeregex(e->ext); + nfreeregex(&e->ext); } } } @@ -292,7 +292,7 @@ void color_update(void) /* Decompile e->ext_regex's specified regex if we aren't * going to use it. */ if (not_compiled) - nfreeregex(e->ext); + nfreeregex(&e->ext); } } }