magrep: fix use of uninitialized memory

found by -fsanitize=memory
pull/163/head
Duncaen 5 years ago committed by Leah Neukirchen
parent 74d8393fdf
commit c8ce6d220c

@ -32,7 +32,7 @@ int
match(char *file, char *hdr, char *s) match(char *file, char *hdr, char *s)
{ {
if (oflag && !cflag && !qflag && !vflag && !lflag) { if (oflag && !cflag && !qflag && !vflag && !lflag) {
regmatch_t pmatch; regmatch_t pmatch = {0};
int len, matched; int len, matched;
matched = 0; matched = 0;
while (*s && regexec(&pattern, s, 1, &pmatch, 0) == 0) { while (*s && regexec(&pattern, s, 1, &pmatch, 0) == 0) {

Loading…
Cancel
Save