Freeing not just the struct but also the data it contains,
and also when it is the first and only line. This fixes Savannah bug #47153 reported by Mike Frysinger. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5646 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
8d005c8743
commit
6c0e5e3f2c
|
@ -1,3 +1,8 @@
|
||||||
|
2016-02-15 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/files.c (read_file): Free not just the struct but also the
|
||||||
|
data it contains, and also when it is the first and only line.
|
||||||
|
This fixes Savannah bug #47153 reported by Mike Frysinger.
|
||||||
|
|
||||||
2016-02-14 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-14 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/search.c (do_replace_loop): Make iterating through replacement
|
* src/search.c (do_replace_loop): Make iterating through replacement
|
||||||
matches behave again like iterating through search matches: showing
|
matches behave again like iterating through search matches: showing
|
||||||
|
|
|
@ -871,6 +871,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||||
/* If the file we got doesn't end in a newline, tack its last
|
/* If the file we got doesn't end in a newline, tack its last
|
||||||
* line onto the beginning of the line at current. */
|
* line onto the beginning of the line at current. */
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
filestruct *dropline = fileptr;
|
||||||
size_t current_len = strlen(openfile->current->data);
|
size_t current_len = strlen(openfile->current->data);
|
||||||
|
|
||||||
/* Adjust the current x-coordinate to compensate for the
|
/* Adjust the current x-coordinate to compensate for the
|
||||||
|
@ -896,11 +897,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||||
if (fileptr == openfile->filebot)
|
if (fileptr == openfile->filebot)
|
||||||
openfile->filebot = openfile->current;
|
openfile->filebot = openfile->current;
|
||||||
|
|
||||||
/* Move fileptr back one line and blow away the old fileptr,
|
/* Step back one line, and blow away the unterminated line,
|
||||||
* since its text has been saved. */
|
* since its text has been copied into current. */
|
||||||
fileptr = fileptr->prev;
|
fileptr = fileptr->prev;
|
||||||
if (fileptr != NULL)
|
delete_node(dropline);
|
||||||
free(fileptr->next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach the line at current after the line at fileptr. */
|
/* Attach the line at current after the line at fileptr. */
|
||||||
|
|
Loading…
Reference in New Issue