Skip to content

Commit

Permalink
- Free the FMU binary properly.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16586 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Jul 12, 2013
1 parent d9c6d6e commit 4719b1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Compiler/runtime/FMIImpl.c
Expand Up @@ -686,12 +686,12 @@ void FMIImpl__releaseFMIImport(void *ptr1, void *ptr2, void *ptr3, const char* f
intptr_t fmiModeVariablesInstance = (intptr_t)RML_FETCH(RML_OFFSET(RML_UNTAGPTR(ptr1),1));
intptr_t fmiInstance = (intptr_t)RML_FETCH(RML_OFFSET(RML_UNTAGPTR(ptr2),1));
intptr_t fmiContext = (intptr_t)RML_FETCH(RML_OFFSET(RML_UNTAGPTR(ptr3),1));
if (strcmp(fmiVersion, "1") == 0) {
if (strcmp(fmiVersion, "1.0") == 0) {
free((fmi1_import_variable_list_t*)fmiModeVariablesInstance);
fmi1_import_t* fmi = (fmi1_import_t*)fmiInstance;
fmi1_import_destroy_dllfmu(fmi);
fmi1_import_free(fmi);
} else if (strcmp(fmiVersion, "2") == 0) {
} else if (strcmp(fmiVersion, "2.0") == 0) {
free((fmi2_import_variable_list_t*)fmiModeVariablesInstance);
fmi2_import_t* fmi = (fmi2_import_t*)fmiInstance;
fmi2_import_destroy_dllfmu(fmi);
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/FMI_rml.c
Expand Up @@ -61,7 +61,7 @@ RML_END_LABEL

RML_BEGIN_LABEL(FMIExt__releaseFMIImport)
{
FMIImpl__releaseFMIImport(rmlA0, rmlA1, rmlA2, RML_STRINGDATA(rmlA2));
FMIImpl__releaseFMIImport(rmlA0, rmlA1, rmlA2, RML_STRINGDATA(rmlA3));
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL
1 change: 1 addition & 0 deletions SimulationRuntime/c/fmi/FMI1ModelExchange.c
Expand Up @@ -82,6 +82,7 @@ void FMI1ModelExchangeDestructor_OMC(void* in_fmi1me)
{
FMI1ModelExchange* FMI1ME = (FMI1ModelExchange*)in_fmi1me;
fmi1_import_terminate(FMI1ME->FMIImportInstance);
fmi1_import_free_model_instance(FMI1ME->FMIImportInstance);
fmi1_import_destroy_dllfmu(FMI1ME->FMIImportInstance);
fmi1_import_free(FMI1ME->FMIImportInstance);
fmi_import_free_context(FMI1ME->FMIImportContext);
Expand Down

0 comments on commit 4719b1d

Please sign in to comment.