mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-29 05:39:55 +03:00
Plugging three tiny memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5520 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
46db638435
commit
9eca195990
@ -1,3 +1,6 @@
|
||||
2016-01-02 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_spell, do_formatter): Plug three tiny memory leaks.
|
||||
|
||||
2015-12-31 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Restore the cursor position differently.
|
||||
* src/search.c (do_gotopos): Delete this now unused function.
|
||||
|
20
src/text.c
20
src/text.c
@ -2850,7 +2850,7 @@ void do_spell(void)
|
||||
{
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
char *temp;
|
||||
const char *spell_msg;
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
@ -2858,6 +2858,8 @@ void do_spell(void)
|
||||
return;
|
||||
}
|
||||
|
||||
temp = safe_tempfile(&temp_file);
|
||||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
@ -3234,7 +3236,7 @@ void do_formatter(void)
|
||||
{
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
char *temp;
|
||||
int format_status;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
@ -3246,6 +3248,13 @@ void do_formatter(void)
|
||||
static char **formatargs = NULL;
|
||||
char *finalstatus = NULL;
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished"));
|
||||
return;
|
||||
}
|
||||
|
||||
temp = safe_tempfile(&temp_file);
|
||||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
@ -3261,11 +3270,6 @@ void do_formatter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished"));
|
||||
return;
|
||||
}
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking formatter, please wait"));
|
||||
doupdate();
|
||||
@ -3299,6 +3303,8 @@ void do_formatter(void)
|
||||
/* If we couldn't fork, get out. */
|
||||
if (pid_format < 0) {
|
||||
statusbar(_("Could not fork"));
|
||||
unlink(temp);
|
||||
free(temp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user