From 4c30c5b8151abcbbeb63f8dc48e0684d00c07071 Mon Sep 17 00:00:00 2001 From: Torsten Sommer Date: Mon, 11 Nov 2024 16:14:47 +0100 Subject: [PATCH] Don't call FreeInstance() if component == NULL (#626) --- fmusim/FMI1CSSimulation.c | 2 +- fmusim/FMI1MESimulation.c | 2 +- fmusim/FMI2CSSimulation.c | 2 +- fmusim/FMI2MESimulation.c | 2 +- fmusim/FMI3CSSimulation.c | 2 +- fmusim/FMI3MESimulation.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fmusim/FMI1CSSimulation.c b/fmusim/FMI1CSSimulation.c index a1fa94e6..3973391b 100644 --- a/fmusim/FMI1CSSimulation.c +++ b/fmusim/FMI1CSSimulation.c @@ -90,7 +90,7 @@ FMIStatus FMI1CSSimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI1FreeSlaveInstance(S); } diff --git a/fmusim/FMI1MESimulation.c b/fmusim/FMI1MESimulation.c index 00c3fbfb..5b993774 100644 --- a/fmusim/FMI1MESimulation.c +++ b/fmusim/FMI1MESimulation.c @@ -182,7 +182,7 @@ FMIStatus FMI1MESimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI1FreeModelInstance(S); } diff --git a/fmusim/FMI2CSSimulation.c b/fmusim/FMI2CSSimulation.c index 1224c691..8da17666 100644 --- a/fmusim/FMI2CSSimulation.c +++ b/fmusim/FMI2CSSimulation.c @@ -135,7 +135,7 @@ FMIStatus FMI2CSSimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI2FreeInstance(S); } diff --git a/fmusim/FMI2MESimulation.c b/fmusim/FMI2MESimulation.c index a7577a2d..d2035be9 100644 --- a/fmusim/FMI2MESimulation.c +++ b/fmusim/FMI2MESimulation.c @@ -232,7 +232,7 @@ FMIStatus FMI2MESimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI2FreeInstance(S); } diff --git a/fmusim/FMI3CSSimulation.c b/fmusim/FMI3CSSimulation.c index 4efa0d16..152908a8 100644 --- a/fmusim/FMI3CSSimulation.c +++ b/fmusim/FMI3CSSimulation.c @@ -254,7 +254,7 @@ FMIStatus FMI3CSSimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI3FreeInstance(S); } diff --git a/fmusim/FMI3MESimulation.c b/fmusim/FMI3MESimulation.c index 4c207a39..8363cce1 100644 --- a/fmusim/FMI3MESimulation.c +++ b/fmusim/FMI3MESimulation.c @@ -246,7 +246,7 @@ FMIStatus FMI3MESimulate(const FMISimulationSettings* s) { } } - if (status != FMIFatal) { + if (status != FMIFatal && S->component) { FMI3FreeInstance(S); }