[hackers] [sbase] Revert "ed: remove double free in join()" || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 10 Jan 2017 08:56:46 +0100 (CET)

commit 78bfd8978ea2af10dadc3fdadd19710068a632c4
Author: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
AuthorDate: Tue Jan 10 08:41:35 2017 +0100
Commit: Roberto E. Vargas Caballero <roberto.vargas_AT_igrid-td.com>
CommitDate: Tue Jan 10 08:41:35 2017 +0100

    Revert "ed: remove double free in join()"
    
    This reverts commit 30da327fbd27eee508c5492a763ea19d7cd9e281.
    The double free is needed to avoid memory leaks when signals are caught

diff --git a/ed.c b/ed.c
index 52b2684..f579116 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -813,8 +813,9 @@ join(void)
         int i;
         char *t, c;
         size_t len = 0, cap = 0;
- char *s;
+ static char *s;
 
+ free(s);
         for (s = NULL, i = line1;; i = nextln(i)) {
                 for (t = gettxt(i); (c = *t) != '\n'; ++t)
                         s = addchar(*t, s, &cap, &len);
Received on Tue Jan 10 2017 - 08:56:46 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 10 2017 - 09:00:19 CET