Re: [hackers] [sbase] Revert "ed: remove double free in join()" ||
Hello Thomas, Sorry for the delay, I had some problems with my mail lately, > The trouble with reverting my commit is that readding the double free > completely > crashes ed if more than one join is performed. I think this patch (which also > reverts > back to having no double free) should handle your concern via blocking signal > handling > until the join is finished. Ok, I understand. Mixing longjmp signals and dynamic memory was a really bad idea. Your idea is not bad, but I think we should block sigprocmask and related functions, instead of playing with variables. Regards,
Re: [hackers] [sbase] Revert "ed: remove double free in join()" || Roberto E. Vargas Caballero
Hello Roberto, The trouble with reverting my commit is that readding the double free completely crashes ed if more than one join is performed. I think this patch (which also reverts back to having no double free) should handle your concern via blocking signal handling until the join is finished. Thomas -- Thomas Mannay0001-ed-ignore-signals-inside-of-join.patch Description: Binary data
[hackers] [sbase] Revert "ed: remove double free in join()" || Roberto E. Vargas Caballero
commit 78bfd8978ea2af10dadc3fdadd19710068a632c4 Author: Roberto E. Vargas CaballeroAuthorDate: Tue Jan 10 08:41:35 2017 +0100 Commit: Roberto E. Vargas Caballero 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 @@ -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, , );