Don't leak olinep if malloc() fails.
If malloc() fails to allocate linep, then free olinep (if it exists) before returning to avoid a memory leak. Reported by: Coverity CID: 1016716 Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6755
This commit is contained in:
parent
d7f12eacbb
commit
2b34ca7d10
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301596
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user