Skip to content

Commit

Permalink
- free the allocated memory.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13135 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 2, 2012
1 parent b375f3e commit 0df382e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Compiler/Template/CodegenFMU.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,8 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
end constructor;

function destructor
input fmiEventInfo eventInfo;
external "C" fmiFreeEventInfo_OMC(eventInfo) annotation(Library = {"omcruntime", "fmilib"});
end destructor;
end fmiEventInfo;

Expand Down Expand Up @@ -1336,7 +1338,7 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
for i in 1:size(fmi_z,1) loop
fmi_z_positive[i] = fmi_z[i] > 0;
end for;
algorithm
algorithm
when change(fmi_z_positive) and not initial() then
//eventInfo := fmiFunctions.fmiEventUpdate(fmi, callEventUpdate, eventInfo);
fmiFunctions.fmiEventUpdate(fmi, callEventUpdate, eventInfo);
Expand Down
6 changes: 6 additions & 0 deletions Compiler/runtime/FMIWrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ void fmiImportFreeInstance_OMC(void* fmi)
fmi1_import_free(fmi1);
}

void fmiFreeEventInfo_OMC(void* eventInfo)
{
if ((fmi1_event_info_t*)eventInfo != NULL)
free((fmi1_event_info_t*)eventInfo);
}

void fmiInstantiateModel_OMC(void* fmi, const char* instanceName)
{
jm_status_enu_t status = fmi1_import_instantiate_model((fmi1_import_t*)fmi, instanceName);
Expand Down

0 comments on commit 0df382e

Please sign in to comment.