Revert "ed: remove double free in join()"

This reverts commit 30da327fbd.
The double free is needed to avoid memory leaks when signals are caught
This commit is contained in:
Roberto E. Vargas Caballero 2017-01-10 08:41:35 +01:00
parent 89f5f84316
commit 78bfd8978e

3
ed.c
View File

@ -813,8 +813,9 @@ join(void)
int i; int i;
char *t, c; char *t, c;
size_t len = 0, cap = 0; size_t len = 0, cap = 0;
char *s; static char *s;
free(s);
for (s = NULL, i = line1;; i = nextln(i)) { for (s = NULL, i = line1;; i = nextln(i)) {
for (t = gettxt(i); (c = *t) != '\n'; ++t) for (t = gettxt(i); (c = *t) != '\n'; ++t)
s = addchar(*t, s, &cap, &len); s = addchar(*t, s, &cap, &len);