diff options
-rw-r--r-- | miscutils/less.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 6b0cab526..eba916a80 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -625,12 +625,11 @@ static char *process_regex_on_line(char *line, regex_t *pattern) | |||
625 | insert_highlights, and then the line is returned. */ | 625 | insert_highlights, and then the line is returned. */ |
626 | 626 | ||
627 | int match_status; | 627 | int match_status; |
628 | char *line2 = (char *) malloc((sizeof(char) * (strlen(line) + 1)) + 64); | 628 | char *line2 = (char *) xmalloc((sizeof(char) * (strlen(line) + 1)) + 64); |
629 | char sub_line[256]; | 629 | char sub_line[256]; |
630 | int prev_eo = 0; | 630 | int prev_eo = 0; |
631 | regmatch_t match_structs; | 631 | regmatch_t match_structs; |
632 | 632 | ||
633 | memset(sub_line, 0, 256); | ||
634 | strcpy(line2, line); | 633 | strcpy(line2, line); |
635 | 634 | ||
636 | match_found = 0; | 635 | match_found = 0; |
@@ -638,7 +637,7 @@ static char *process_regex_on_line(char *line, regex_t *pattern) | |||
638 | 637 | ||
639 | while (match_status == 0) { | 638 | while (match_status == 0) { |
640 | 639 | ||
641 | memset(sub_line, 0, 256); | 640 | memset(sub_line, 0, sizeof(sub_line)); |
642 | 641 | ||
643 | if (match_found == 0) | 642 | if (match_found == 0) |
644 | match_found = 1; | 643 | match_found = 1; |