mirror of
https://github.com/nasa/trick.git
synced 2025-02-20 17:22:52 +00:00
remove memory leaks and garbage return values TrickBinary.cpp
This commit is contained in:
parent
a60cc3f2ae
commit
28863c58a6
@ -158,7 +158,7 @@ TrickBinary::TrickBinary(char * file_name , char * param_name ) {
|
||||
|
||||
if ( ! strcmp( name_ptr , param_name )) {
|
||||
if ( !strcmp(units_ptr,"--") ) {
|
||||
unitStr_ = strdup(units_ptr) ;
|
||||
unitStr_ = units_ptr ;
|
||||
} else {
|
||||
unitStr_ = map_trick_units_to_udunits(units_ptr) ;
|
||||
}
|
||||
@ -374,7 +374,7 @@ int TrickBinaryReadByteOrder( FILE* fp ) {
|
||||
const int file_type_len = 10 ;
|
||||
char file_type[file_type_len + 1] ;
|
||||
int my_byte_order ;
|
||||
int swap ;
|
||||
int swap = 0;
|
||||
|
||||
memset(file_type, 0 , 10 ) ;
|
||||
fread(file_type , file_type_len , 1 , fp ) ;
|
||||
@ -581,6 +581,6 @@ int TrickBinaryLocateParam( const char * file_name , const char * param_name ) {
|
||||
for ( ii = 0 ; ii < num_vars ; ii++ ) {
|
||||
delete[] var_names[ii] ;
|
||||
}
|
||||
|
||||
delete[] var_names;
|
||||
return(found) ;
|
||||
}
|
||||
|
@ -99,10 +99,10 @@ std::string Trick::MonteVarFile::get_next_value() {
|
||||
ss << name << " = " << "trick.attach_units(\"" << unit << "\", " << token << ")";
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
if(temp_str) {
|
||||
free(temp_str);
|
||||
temp_str = nullptr;
|
||||
if(temp_str) {
|
||||
free(temp_str);
|
||||
temp_str = nullptr;
|
||||
}
|
||||
}
|
||||
char string[100];
|
||||
sprintf(string, "Trick:MonteVarFile the input file \"%s\" is not open for reading", file_name.c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user