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
@ -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 New Issue
Block a user