Not checking for non-NULL before freeing a variable, as it's unnecessary.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
18
src/files.c
18
src/files.c
@@ -830,10 +830,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
/* Move fileptr back one line and blow away the old fileptr,
|
||||
* since its text has been saved. */
|
||||
fileptr = fileptr->prev;
|
||||
if (fileptr != NULL) {
|
||||
if (fileptr->next != NULL)
|
||||
free(fileptr->next);
|
||||
}
|
||||
if (fileptr != NULL)
|
||||
free(fileptr->next);
|
||||
}
|
||||
|
||||
/* Attach the line at current after the line at fileptr. */
|
||||
@@ -1454,8 +1452,7 @@ char *get_full_path(const char *origpath)
|
||||
}
|
||||
|
||||
/* Free d_there_file, since we're done using it. */
|
||||
if (d_there_file != NULL)
|
||||
free(d_there_file);
|
||||
free(d_there_file);
|
||||
|
||||
return d_there;
|
||||
}
|
||||
@@ -2177,8 +2174,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
|
||||
cleanup_and_exit:
|
||||
free(realname);
|
||||
if (tempname != NULL)
|
||||
free(tempname);
|
||||
free(tempname);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2401,10 +2397,8 @@ bool do_writeout(bool exiting)
|
||||
* string's real length. */
|
||||
unsunder(answer, answer_len);
|
||||
|
||||
if (full_filename != NULL)
|
||||
free(full_filename);
|
||||
if (full_answer != NULL)
|
||||
free(full_answer);
|
||||
free(full_filename);
|
||||
free(full_answer);
|
||||
|
||||
if (do_warning) {
|
||||
/* If we're using restricted mode, we aren't allowed
|
||||
|
||||
Reference in New Issue
Block a user