Commit e9c962b4c064003a43b65b1085d8b8052fe57617

Authored by Benjamin Renard
1 parent 6af5b7f6

Fix bug => do not free Variables memory twice!! (this case can be occured with a…

… remoted VirtualInstrument)
Showing 1 changed file with 5 additions and 2 deletions   Show diff stats
src/SERVER/DD_GetData.c
@@ -588,9 +588,12 @@ int GetAttribute(int ID, char *VarName) @@ -588,9 +588,12 @@ int GetAttribute(int ID, char *VarName)
588 DD_Var[ID]->VarData[il].VarNumber = 0; 588 DD_Var[ID]->VarData[il].VarNumber = 0;
589 } 589 }
590 //BRE - 17/09/15 - Free variables !! 590 //BRE - 17/09/15 - Free variables !!
591 - if((DD_Var[ID]->LastPacketFlag == OK) || DD_Var[ID]->NewFile) // Request been finished or  
592 - // System was trying to open new file 591 + if(((DD_Var[ID]->LastPacketFlag == OK) || DD_Var[ID]->NewFile) && (DD_Var[ID]->VarData[il].Variables != NULL)) // Request been finished or
  592 + // System was trying to open new file
  593 + {
593 free(DD_Var[ID]->VarData[il].Variables); 594 free(DD_Var[ID]->VarData[il].Variables);
  595 + DD_Var[ID]->VarData[il].Variables = NULL;
  596 + }
594 } 597 }
595 598
596 /*============================================================================ 599 /*============================================================================