mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Fix 66b32df7
: Use after free in GRFFileScanner::AddFile
This commit is contained in:
parent
fe4fa46da3
commit
beeab28e78
@ -781,10 +781,6 @@ bool GRFFileScanner::AddFile(const char *filename, size_t basepath_length, const
|
|||||||
bool added = FillGRFDetails(c, false);
|
bool added = FillGRFDetails(c, false);
|
||||||
if (added) {
|
if (added) {
|
||||||
this->grfs.push_back(c);
|
this->grfs.push_back(c);
|
||||||
} else {
|
|
||||||
/* File couldn't be opened, or is either not a NewGRF or is a
|
|
||||||
* 'system' NewGRF or it's already known, so forget about it. */
|
|
||||||
delete c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->num_scanned++;
|
this->num_scanned++;
|
||||||
@ -803,6 +799,12 @@ bool GRFFileScanner::AddFile(const char *filename, size_t basepath_length, const
|
|||||||
this->next_update = _realtime_tick + MODAL_PROGRESS_REDRAW_TIMEOUT;
|
this->next_update = _realtime_tick + MODAL_PROGRESS_REDRAW_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!added) {
|
||||||
|
/* File couldn't be opened, or is either not a NewGRF or is a
|
||||||
|
* 'system' NewGRF or it's already known, so forget about it. */
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
|
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user