Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81783c6

Browse files
authored
Merge pull request godotengine#333 from sheepandshepherd/string-plus-leak
Fix String::operator+ memory leak
2 parents 7cbb846 + 9560cbf commit 81783c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/String.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ bool String::operator!=(const String &s) const {
124124
}
125125

126126
String String::operator+(const String &s) const {
127-
String new_string = *this;
128-
new_string._godot_string = godot::api->godot_string_operator_plus(&new_string._godot_string, &s._godot_string);
127+
String new_string;
128+
new_string._godot_string = godot::api->godot_string_operator_plus(&_godot_string, &s._godot_string);
129129

130130
return new_string;
131131
}

0 commit comments

Comments
 (0)