diff options
author | Ron Yorston <rmy@pobox.com> | 2023-01-05 08:56:27 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-01-05 08:56:27 +0000 |
commit | e5e4a2fec5435192d1672e6db2f335cb5e89f877 (patch) | |
tree | 08cb827a40817ea4824bc9336d57eda669c4d4b2 /editors | |
parent | 4343f3926355f55fc023203c992527fc34bf609e (diff) | |
parent | b1884deb514c35289d37e7bfbf23f770b0bd09b3 (diff) | |
download | busybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.tar.gz busybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.tar.bz2 busybox-w32-e5e4a2fec5435192d1672e6db2f335cb5e89f877.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'editors')
-rw-r--r-- | editors/sed.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c index f4a5f7b8a..07f7b7a9b 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -102,7 +102,7 @@ enum { | |||
102 | 102 | ||
103 | struct sed_FILE { | 103 | struct sed_FILE { |
104 | struct sed_FILE *next; /* Next (linked list, NULL terminated) */ | 104 | struct sed_FILE *next; /* Next (linked list, NULL terminated) */ |
105 | const char *fname; | 105 | char *fname; |
106 | FILE *fp; | 106 | FILE *fp; |
107 | }; | 107 | }; |
108 | 108 | ||
@@ -194,9 +194,6 @@ static void sed_free_and_close_stuff(void) | |||
194 | while (sed_cmd) { | 194 | while (sed_cmd) { |
195 | sed_cmd_t *sed_cmd_next = sed_cmd->next; | 195 | sed_cmd_t *sed_cmd_next = sed_cmd->next; |
196 | 196 | ||
197 | if (sed_cmd->sw_file) | ||
198 | fclose(sed_cmd->sw_file); | ||
199 | |||
200 | /* Used to free regexps, but now there is code | 197 | /* Used to free regexps, but now there is code |
201 | * in get_address() which can reuse a regexp | 198 | * in get_address() which can reuse a regexp |
202 | * for constructs as /regexp/cmd1;//cmd2 | 199 | * for constructs as /regexp/cmd1;//cmd2 |
@@ -223,6 +220,18 @@ static void sed_free_and_close_stuff(void) | |||
223 | 220 | ||
224 | if (G.current_fp) | 221 | if (G.current_fp) |
225 | fclose(G.current_fp); | 222 | fclose(G.current_fp); |
223 | |||
224 | if (G.FILE_head) { | ||
225 | struct sed_FILE *cur = G.FILE_head; | ||
226 | do { | ||
227 | struct sed_FILE *p; | ||
228 | fclose(cur->fp); | ||
229 | free(cur->fname); | ||
230 | p = cur; | ||
231 | cur = cur->next; | ||
232 | free(p); | ||
233 | } while (cur); | ||
234 | } | ||
226 | } | 235 | } |
227 | #else | 236 | #else |
228 | void sed_free_and_close_stuff(void); | 237 | void sed_free_and_close_stuff(void); |