From 9f613bc739c8a13272e5c6d71f0d32bc29fa63fc Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sun, 15 Nov 2015 06:10:04 +0000 Subject: [PATCH] Backport r5287 from trunk. git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_4_branch@5407 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/files.c | 2 +- src/nano.c | 1 + src/nano.h | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f2f9c6c..2208116a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-07-10 Benno Schulenberg + * src/nano.c (delete_opennode): Plug a small memory leak. + 2015-06-28 Benno Schulenberg * src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h, src/rcfile.c (parse_binding): When defining the toggles, give each diff --git a/src/files.c b/src/files.c index fb47d944..ca8848ff 100644 --- a/src/files.c +++ b/src/files.c @@ -224,7 +224,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi return -1; } - openfile->lock_filename = lockfilename; + openfile->lock_filename = (char *) lockfilename; return 1; } diff --git a/src/nano.c b/src/nano.c index e87caa87..7fc8a429 100644 --- a/src/nano.c +++ b/src/nano.c @@ -569,6 +569,7 @@ void delete_opennode(openfilestruct *fileptr) free_filestruct(fileptr->fileage); #ifndef NANO_TINY free(fileptr->current_stat); + free(fileptr->lock_filename); #endif free(fileptr); } diff --git a/src/nano.h b/src/nano.h index db7be93b..d3b98d87 100644 --- a/src/nano.h +++ b/src/nano.h @@ -397,7 +397,7 @@ typedef struct openfilestruct { undo *current_undo; /* The current (i.e. next) level of undo. */ undo_type last_action; - const char *lock_filename; + char *lock_filename; /* The path of the lockfile, if we created one. */ #endif #ifndef DISABLE_COLOR -- 2.39.5