Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/usr.bin/grep/util.c 210389 2010-07-22 19:11:57Z gabor $");
---
> __FBSDID("$FreeBSD: head/usr.bin/grep/util.c 210430 2010-07-23 19:36:11Z delphij $");
63c63
< char *d, *dir;
---
> char *d, *dir = NULL;
85c85
< err(2, NULL);
---
> err(2, "fts_open");
106,110c106,111
< d = strrchr(p->fts_path, '/');
< dir = grep_malloc(sizeof(char) *
< (d - p->fts_path + 2));
< strlcpy(dir, p->fts_path,
< (d - p->fts_path + 1));
---
> if ((d = strrchr(p->fts_path, '/')) != NULL) {
> dir = grep_malloc(sizeof(char) *
> (d - p->fts_path + 2));
> strlcpy(dir, p->fts_path,
> (d - p->fts_path + 1));
> }
119c120
< if (strstr(dir,
---
> if (dir != NULL && strstr(dir,
125c126,127
< free(dir);
---
> free(dir);
> dir = NULL;
133a136
> fts_close(fts);
198a202
> free(ln.file);
232a237
> free(ln.file);