aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/editors/sed.c b/editors/sed.c
index c0d79cc7b..b7add1fb1 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1300,16 +1300,17 @@ static void process_files(void)
1300 case 'n': 1300 case 'n':
1301 if (!G.be_quiet) 1301 if (!G.be_quiet)
1302 sed_puts(pattern_space, last_gets_char); 1302 sed_puts(pattern_space, last_gets_char);
1303 if (next_line) { 1303 if (next_line == NULL) {
1304 free(pattern_space); 1304 /* If no next line, jump to end of script and exit. */
1305 pattern_space = next_line; 1305 goto discard_line;
1306 last_gets_char = next_gets_char;
1307 next_line = get_next_line(&next_gets_char, &last_puts_char);
1308 substituted = 0;
1309 linenum++;
1310 break;
1311 } 1306 }
1312 /* fall through */ 1307 free(pattern_space);
1308 pattern_space = next_line;
1309 last_gets_char = next_gets_char;
1310 next_line = get_next_line(&next_gets_char, &last_puts_char);
1311 substituted = 0;
1312 linenum++;
1313 break;
1313 1314
1314 /* Quit. End of script, end of input. */ 1315 /* Quit. End of script, end of input. */
1315 case 'q': 1316 case 'q':