]> git.wh0rd.org Git - nano.git/commitdiff
Plugging another memory leak.
authorBenno Schulenberg <bensberg@justemail.net>
Fri, 29 Jan 2016 20:39:12 +0000 (20:39 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Fri, 29 Jan 2016 20:39:12 +0000 (20:39 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5600 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index 3d38021a9f18a35bbdda57764b0286565ce70d14..60c9fd0ed65049acf4606dc35e5d4f42a3c1cd1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * src/nano.c (main): Check position history only when 'positionlog'
        is set.  This fixes a bug unconsciously reported by Mike Frysinger.
        * src/files.c (do_lockfile): Plug a couple of memory leaks.
+       * src/files.c (update_poshistory): Plug another memory leak.
 
 2016-01-26  Benno Schulenberg  <bensberg@justemail.net>
        * src/files.c (update_poshistory): Do not add directories to the
index 6df25ba00aa747b64c85f5826fbf9a9fa3aafcc4..c6b2339408dee11432898b8c3c3e8019f08be9da 100644 (file)
@@ -3205,8 +3205,10 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
     poshiststruct *posptr, *theone, *posprev = NULL;
     char *fullpath = get_full_path(filename);
 
-    if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/')
+    if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
+       free(fullpath);
        return;
+    }
 
     /* Look for a matching filename in the list. */
     for (posptr = position_history; posptr != NULL; posptr = posptr->next) {