From 1cbffa09de4355e3af72728c416ea1dbbb615927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 10 Apr 2014 12:25:28 +0200 Subject: [PATCH] Fix memory leak Function GridManager::createGrdecl() generally allocates memory (using std::malloc()) for the MAPAXES keyword data output of the 'grdecl' structure. Release those resources before leaving the scope to prevent memory leak introduced in commit fdca540. --- examples/sim_fibo_ad_cp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/sim_fibo_ad_cp.cpp b/examples/sim_fibo_ad_cp.cpp index 63ad47d5b..63856026e 100644 --- a/examples/sim_fibo_ad_cp.cpp +++ b/examples/sim_fibo_ad_cp.cpp @@ -73,6 +73,7 @@ #include #include +#include #include #include #include @@ -130,6 +131,8 @@ try GridManager::createGrdecl(newParserDeck, g); grid->processEclipseFormat(g, 2e-12, false); + + std::free(const_cast(g.mapaxes)); }