mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
Fix a memory leak in VariableServerThread_commands. Ref #333
This commit is contained in:
parent
8ad462cd1c
commit
99c8b11709
@ -98,6 +98,7 @@ int Trick::VariableServerThread::var_remove(std::string in_name) {
|
|||||||
for ( ii = 0 ; ii < vars.size() ; ii++ ) {
|
for ( ii = 0 ; ii < vars.size() ; ii++ ) {
|
||||||
std::string var_name = vars[ii]->ref->reference;
|
std::string var_name = vars[ii]->ref->reference;
|
||||||
if ( ! var_name.compare(in_name) ) {
|
if ( ! var_name.compare(in_name) ) {
|
||||||
|
delete vars[ii];
|
||||||
vars.erase(vars.begin() + ii) ;
|
vars.erase(vars.begin() + ii) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
@ -188,7 +189,10 @@ int Trick::VariableServerThread::var_exists(std::string in_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Trick::VariableServerThread::var_clear() {
|
int Trick::VariableServerThread::var_clear() {
|
||||||
vars.clear() ;
|
while( !vars.empty() ) {
|
||||||
|
delete vars.back();
|
||||||
|
vars.pop_back();
|
||||||
|
}
|
||||||
return(0) ;
|
return(0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user