From 65c49620801594ad92f2956efdbee942dec707ce Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 23 Jul 2016 18:12:48 -0500 Subject: Usischev Yury pointed out a use after free error. --- toys/posix/sed.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toys/posix/sed.c b/toys/posix/sed.c index 45816c29..45331bac 100644 --- a/toys/posix/sed.c +++ b/toys/posix/sed.c @@ -635,8 +635,6 @@ writenow: if (line && !(toys.optflags & FLAG_n)) emit(line, len, eol); done: - free(line); - if (dlist_terminate(append)) while (append) { struct append *a = append->next; @@ -655,6 +653,7 @@ done: free(append); append = a; } + free(line); } // Genericish function, can probably get moved to lib.c -- cgit v1.2.3