svn commit: r300449 - stable/10/usr.sbin/config
Don Lewis
truckman at FreeBSD.org
Mon May 23 04:47:26 UTC 2016
Author: truckman
Date: Mon May 23 04:47:24 2016
New Revision: 300449
URL: https://svnweb.freebsd.org/changeset/base/300449
Log:
MFC r299893
Don't free fnamebuf before we calling cfgfile_add(). This changes a
use-after-free error into a minor memory leak.
Reported by: Coverity
CID: 1006084
Modified:
stable/10/usr.sbin/config/lang.l
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/usr.sbin/config/lang.l
==============================================================================
--- stable/10/usr.sbin/config/lang.l Mon May 23 04:17:27 2016 (r300448)
+++ stable/10/usr.sbin/config/lang.l Mon May 23 04:47:24 2016 (r300449)
@@ -267,7 +267,8 @@ include(const char *fname, int ateof)
asprintf(&fnamebuf, "../../conf/%s", fname);
if (fnamebuf != NULL) {
fp = fopen(fnamebuf, "r");
- free(fnamebuf);
+ if (fp == NULL)
+ free(fnamebuf);
}
}
if (fp == NULL) {
@@ -275,10 +276,10 @@ include(const char *fname, int ateof)
asprintf(&fnamebuf, "%s/%s", ipath->path, fname);
if (fnamebuf != NULL) {
fp = fopen(fnamebuf, "r");
- free(fnamebuf);
}
if (fp != NULL)
break;
+ free(fnamebuf);
}
}
if (fp == NULL) {
More information about the svn-src-stable-10
mailing list