mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
fix memory error: dangling pointer. Fixes TrickView unit bug
This commit is contained in:
parent
cb3a6965d1
commit
c325f67d22
@ -1 +1 @@
|
||||
current_version = "17.5.0"
|
||||
current_version = "17.6.dev"
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
#include "trick/VariableServer.hh"
|
||||
#include "trick/exec_proto.h"
|
||||
@ -8,6 +9,7 @@
|
||||
#include "trick/memorymanager_c_intf.h"
|
||||
#include "trick/map_trick_units_to_udunits.hh"
|
||||
|
||||
|
||||
extern Trick::VariableServer * the_vs ;
|
||||
|
||||
Trick::VariableServerThread * get_vst() {
|
||||
@ -530,11 +532,14 @@ int var_set_base( const char * var , T value , const char * units ) {
|
||||
v_tree.v_data = &v_data ;
|
||||
var_set_value( v_data , value) ;
|
||||
if ( units != NULL ) {
|
||||
ref->units = (char *)(map_trick_units_to_udunits(units).c_str()) ;
|
||||
ref->units = strdup(map_trick_units_to_udunits(units).c_str()) ;
|
||||
} else {
|
||||
ref->units = (char *)units ;
|
||||
ref->units = NULL ;
|
||||
}
|
||||
ref_assignment(ref , &v_tree) ;
|
||||
if(ref->units != NULL) {
|
||||
free(ref->units) ;
|
||||
}
|
||||
free(ref) ;
|
||||
} else {
|
||||
message_publish(MSG_WARNING,"Cannot assign to %s because io_spec does not allow input\n", var) ;
|
||||
|
Loading…
Reference in New Issue
Block a user