Fixed memory leak from pet imports (#5283)
Fixes #5279 Thanks to @mplaten
This commit is contained in:
@@ -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 ){
|
||||
|
||||
Reference in New Issue
Block a user