Commit 95e1f555 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Plugging a tiny leak.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5341 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 15 additions and 11 deletions
+15 -11
......@@ -2,6 +2,7 @@
* src/rcfile.c (parse_binding): Check the value of shortcut->toggle
only if it actually is a toggle. Found with valgrind.
* src/files.c (write_lockfile): Plug a leak. Found with valgrind.
* src/rcfile.c (parse_binding): Plug a tiny leak.
2015-08-02 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (initialize_buffer): Initialize also openfile->syntax.
......
......@@ -444,7 +444,7 @@ void parse_binding(char *ptr, bool dobind)
if (strlen(keycopy) < 2) {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
/* Uppercase only the first two or three characters of the key name. */
......@@ -455,7 +455,7 @@ void parse_binding(char *ptr, bool dobind)
keycopy[2] = toupper(keycopy[2]);
else {
rcfile_error(N_("Key name is too short"));
return;
goto free_copy;
}
}
......@@ -465,7 +465,7 @@ void parse_binding(char *ptr, bool dobind)
keycopy[1] = tolower(keycopy[1]);
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
return;
goto free_copy;
}
if (dobind) {
......@@ -474,7 +474,7 @@ void parse_binding(char *ptr, bool dobind)
if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to"));
return;
goto free_copy;
}
}
......@@ -484,21 +484,21 @@ void parse_binding(char *ptr, bool dobind)
if (menuptr[0] == '\0') {
/* TRANSLATORS: Do not translate the word "all". */
rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
return;
goto free_copy;
}
if (dobind) {
newsc = strtosc(funcptr);
if (newsc == NULL) {
rcfile_error(N_("Cannot map name \"%s\" to a function"), funcptr);
return;
goto free_copy;
}
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
return;
goto free_copy;
}
#ifdef DEBUG
......@@ -531,7 +531,7 @@ void parse_binding(char *ptr, bool dobind)
if (!menu) {
rcfile_error(N_("Function '%s' does not exist in menu '%s'"), funcptr, menuptr);
free(newsc);
return;
goto free_copy;
}
newsc->keystr = keycopy;
......@@ -546,7 +546,7 @@ void parse_binding(char *ptr, bool dobind)
if (check_bad_binding(newsc)) {
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
free(newsc);
return;
goto free_copy;
}
}
......@@ -571,7 +571,10 @@ void parse_binding(char *ptr, bool dobind)
/* Add the new shortcut at the start of the list. */
newsc->next = sclist;
sclist = newsc;
} else
return;
}
free_copy:
free(keycopy);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment