mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Fix the resource leak of a 'FILE *' which could happen in routine
ctl_readcf() if a call to malloc failed. PR: 204955 Reported by: David Binderman
This commit is contained in:
parent
df5f14797b
commit
02e8b7b2e7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330787
|
@ -292,8 +292,10 @@ ctl_readcf(const char *ptrname, const char *cfname)
|
|||
msize = sroom2 + CTI_LINEMAX;
|
||||
msize = roundup(msize, 8);
|
||||
cstart = malloc(msize);
|
||||
if (cstart == NULL)
|
||||
if (cstart == NULL) {
|
||||
fclose(cfile);
|
||||
return NULL;
|
||||
}
|
||||
memset(cstart, 0, msize);
|
||||
cpriv = (struct cjprivate *)cstart;
|
||||
cpriv->pub.cji_priv = cpriv;
|
||||
|
|
Loading…
Reference in a new issue