Skip to content

Commit

Permalink
Merge pull request #49 from allanleal/fix-memory-leak
Browse files Browse the repository at this point in the history
Fixed memory leak in `thermoPropertiesGasCORK`
  • Loading branch information
gdmiron authored Nov 26, 2022
2 parents fad1a03 + 1f211db commit 47882c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(CCache)

# Set the name of the project
project(ThermoFun VERSION 0.4.0 LANGUAGES CXX)
project(ThermoFun VERSION 0.4.1 LANGUAGES CXX)

# Define variables with the GNU standard installation directories
include(GNUInstallDirs)
Expand Down
5 changes: 3 additions & 2 deletions ThermoFun/Substances/Gases/GasCORK.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <array>
#include "Substances/Gases/GasCORK.h"
#include "Substances/Gases/s_solmod_.h"
#include "Substance.h"
Expand All @@ -18,13 +19,13 @@ auto thermoPropertiesGasCORK(Reaktoro_::Temperature TK, Reaktoro_::Pressure Pbar

solmod::TCORKcalc myCORK( 1, Pbar.val, (TK.val), Eos_Code ); // modified 05.11.2010 (TW)
double TClow = subst.thermoParameters().temperature_intervals[0][0];
double * CPg = new double[7];
std::array<double, 7> CPg;
for (unsigned int i = 0; i < 7; i++)
{
CPg[i] = subst.thermoParameters().critical_parameters[i];
}

myCORK.CORKCalcFugPure( (TClow/*+273.15*/), (CPg), FugProps );
myCORK.CORKCalcFugPure( (TClow/*+273.15*/), CPg.data(), FugProps );

// increment thermodynamic properties
tps.gibbs_energy += R_CONSTANT * (TK) * log( FugProps[0] ); // from ideal gas at 1 bar and givent T to pure real gas/fluid at T and P
Expand Down

0 comments on commit 47882c2

Please sign in to comment.