changeset 526:4dc0ea12d537

fix memory leak
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 19 Jul 2024 14:00:08 +0200
parents 586b80ea397c
children 61338585e7f7 fa6d3c5ada3d
files Framework/Common/DatabaseManager.cpp
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/DatabaseManager.cpp	Thu Jun 06 14:43:38 2024 +0200
+++ b/Framework/Common/DatabaseManager.cpp	Fri Jul 19 14:00:08 2024 +0200
@@ -663,13 +663,11 @@
       statement_.reset(GetManager().GetDatabase().Compile(*query));
       assert(statement_.get() != NULL);
 
+      std::unique_ptr<IResult> result(GetTransaction().Execute(*statement_, parameters));
+
       if (withResults)
       {
-        SetResult(GetTransaction().Execute(*statement_, parameters));
-      }
-      else
-      {
-        GetTransaction().Execute(*statement_, parameters);
+        SetResult(result.release());
       }
     }
     catch (Orthanc::OrthancException& e)