Skip to content

Commit

Permalink
Fix heap-use-after-free when resource loaded with load_threaded_reque…
Browse files Browse the repository at this point in the history
…st is never fetched

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
  • Loading branch information
timothyqiu and RandomShaper committed Oct 23, 2023
1 parent 8c25a98 commit dc7e309
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,9 @@ void ResourceLoader::clear_thread_load_tasks() {
thread_load_mutex.lock();
}

for (KeyValue<String, LoadToken *> &E : user_load_tokens) {
memdelete(E.value);
while (user_load_tokens.begin()) {
// User load tokens remove themselves from the map on destruction.
memdelete(user_load_tokens.begin()->value);
}
user_load_tokens.clear();

Expand Down

0 comments on commit dc7e309

Please sign in to comment.