diff --git a/ChangeLog b/ChangeLog index ee485fb66e09b25495c4188b024d31720b966e21..772b422002b9a06a6100f6bb1db19edae395b6d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-07-22 Mike Frysinger <vapier@gentoo.org> + * src/files.c (check_dotnano), src/global.c (thanks_for_all_the_fish), + src/rcfile.c (parse_binding): Plug a few memory leaks. + 2015-07-19 Benno Schulenberg <bensberg@justemail.net> * src/nano.c (main): Accept again a +LINE argument for each file given on the command line. This fixes Savannah bug #45576. diff --git a/src/files.c b/src/files.c index 3c417b7f21f595386d46b29bf7edd09b9b325337..55e330bb7fc773029e652f61efe3ba4378b8f595 100644 --- a/src/files.c +++ b/src/files.c @@ -2952,6 +2952,7 @@ void history_error(const char *msg, ...) * successfully created, and return 0 otherwise. */ int check_dotnano(void) { + int ret = 1; struct stat dirstat; char *nanodir = construct_filename("/.nano"); @@ -2960,15 +2961,17 @@ int check_dotnano(void) history_error(N_("Unable to create directory %s: %s\n" "It is required for saving/loading search history or cursor positions.\n"), nanodir, strerror(errno)); - return 0; + ret = 0; } } else if (!S_ISDIR(dirstat.st_mode)) { history_error(N_("Path %s is not a directory and needs to be.\n" "Nano will be unable to load or save search history or cursor positions.\n"), nanodir); - return 0; + ret = 0; } - return 1; + + free(nanodir); + return ret; } /* Load the search and replace histories from ~/.nano/search_history. */ diff --git a/src/global.c b/src/global.c index 209fc4e8594ab2c6d1364dd6aaa71e283fb1b484..4e28e7a10f230905aea61944d78b476428de5e34 100644 --- a/src/global.c +++ b/src/global.c @@ -1613,6 +1613,8 @@ void thanks_for_all_the_fish(void) syntaxtype *bill = syntaxes; free(syntaxes->desc); + free(syntaxes->linter); + free(syntaxes->formatter); while (syntaxes->extensions != NULL) { regexlisttype *bob = syntaxes->extensions; syntaxes->extensions = bob->next; diff --git a/src/rcfile.c b/src/rcfile.c index f07e80ca4891f90f6d575c9a509f68c65bc85335..2f9332339a4987a1b822987b6a21d7187e9d6f9d 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -571,7 +571,8 @@ void parse_binding(char *ptr, bool dobind) /* Add the new shortcut at the start of the list. */ newsc->next = sclist; sclist = newsc; - } + } else + free(keycopy); }