Line buffers allocated in preadline() were never freed. ok?
Index: diffreg.c =================================================================== RCS file: /cvs/src/usr.bin/diff/diffreg.c,v retrieving revision 1.91 diff -u -p -r1.91 diffreg.c --- diffreg.c 1 Mar 2016 20:57:35 -0000 1.91 +++ diffreg.c 2 Apr 2018 17:37:34 -0000 @@ -966,7 +966,6 @@ restart: if (diff_format != D_IFDEF && a > b && c > d) return; if (ignore_pats != NULL) { - char *line; /* * All lines in the change, insert, or delete must * match an ignore pattern for the change to be @@ -974,18 +973,24 @@ restart: */ if (a <= b) { /* Changes and deletes. */ for (i = a; i <= b; i++) { - line = preadline(fileno(f1), + char *line = preadline(fileno(f1), ixold[i] - ixold[i - 1], ixold[i - 1]); - if (!ignoreline(line)) + if (!ignoreline(line)) { + free(line); goto proceed; + } + free(line); } } if (a > b || c <= d) { /* Changes and inserts. */ for (i = c; i <= d; i++) { - line = preadline(fileno(f2), + char *line = preadline(fileno(f2), ixnew[i] - ixnew[i - 1], ixnew[i - 1]); - if (!ignoreline(line)) + if (!ignoreline(line)) { + free(line); goto proceed; + } + free(line); } } return;