aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-07-23 18:12:48 -0500
committerRob Landley <rob@landley.net>2016-07-23 18:12:48 -0500
commit65c49620801594ad92f2956efdbee942dec707ce (patch)
tree0e6eaa748ed912d2e8965384727f85347c2c49e6 /toys/posix
parent12adb4113d7c269f26c53292f91079b7c2fee3d1 (diff)
downloadtoybox-65c49620801594ad92f2956efdbee942dec707ce.tar.gz
Usischev Yury pointed out a use after free error.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/sed.c3
1 files changed, 1 insertions, 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