diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 0dcf2a2ebd82..71a36e25bba6 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -614,6 +614,8 @@ read_for_group(const char *group) if (linep == NULL) { free(lp->l_groupname); free(lp); + if (olen > 0) + free(olinep); return (NULL); } if (olen > 0) {