aboutsummaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index ef462843b..e3cce433e 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -848,7 +848,7 @@ static sed_cmd_t *branch_to(char *label)
848 848
849static void append(char *s) 849static void append(char *s)
850{ 850{
851 llist_add_to_end(&G.append_head, xstrdup(s)); 851 llist_add_to_end(&G.append_head, s);
852} 852}
853 853
854static void flush_append(void) 854static void flush_append(void)
@@ -1181,7 +1181,7 @@ static void process_files(void)
1181 1181
1182 /* Append line to linked list to be printed later */ 1182 /* Append line to linked list to be printed later */
1183 case 'a': 1183 case 'a':
1184 append(sed_cmd->string); 1184 append(xstrdup(sed_cmd->string));
1185 break; 1185 break;
1186 1186
1187 /* Insert text before this line */ 1187 /* Insert text before this line */
@@ -1203,11 +1203,10 @@ static void process_files(void)
1203 rfile = fopen_for_read(sed_cmd->string); 1203 rfile = fopen_for_read(sed_cmd->string);
1204 if (rfile) { 1204 if (rfile) {
1205 char *line; 1205 char *line;
1206
1207 while ((line = xmalloc_fgetline(rfile)) 1206 while ((line = xmalloc_fgetline(rfile))
1208 != NULL) 1207 != NULL)
1209 append(line); 1208 append(line);
1210 xprint_and_close_file(rfile); 1209 fclose(rfile);
1211 } 1210 }
1212 1211
1213 break; 1212 break;