Skip to content

Commit

Permalink
Merge pull request #40928 from bruvzg/fix_test_heap_use_after_free
Browse files Browse the repository at this point in the history
Fix heap use after free in the doctest "main".
  • Loading branch information
akien-mga authored Jul 31, 2020
2 parents 92d39d1 + 0a89498 commit 29df191
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ int test_main(int argc, char *argv[]) {
char **args = new char *[valid_arguments.size()];
for (int x = 0; x < valid_arguments.size(); x++) {
// Operation to convert Godot string to non wchar string.
const char *str = valid_arguments[x].utf8().ptr();
CharString cs = valid_arguments[x].utf8();
const char *str = cs.get_data();
// Allocate the string copy.
args[x] = new char[strlen(str) + 1];
// Copy this into memory.
Expand Down

0 comments on commit 29df191

Please sign in to comment.