mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
b3e348206c
commit
8f2c79ef85
1 changed files with 3 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue