Fixed memory leak from pet imports (#5283)

Fixes #5279

Thanks to @mplaten
This commit is contained in:
Lemongrass3110
2020-08-07 21:38:56 +02:00
committed by GitHub
parent dd4cce55a3
commit c86a5a4536

View File

@@ -373,6 +373,11 @@ uint64 PetDatabase::parseBodyNode( const YAML::Node &node ){
return 0;
}
if( pet->pet_bonus_script != nullptr ){
aFree( pet->pet_bonus_script );
pet->pet_bonus_script = nullptr;
}
pet->pet_bonus_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["Script"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
}else{
if( !exists ){
@@ -387,6 +392,11 @@ uint64 PetDatabase::parseBodyNode( const YAML::Node &node ){
return 0;
}
if( pet->pet_support_script != nullptr ){
aFree( pet->pet_support_script );
pet->pet_support_script = nullptr;
}
pet->pet_support_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["SupportScript"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
}else{
if( !exists ){