summaryrefslogtreecommitdiffstats
path: root/matlab/mex
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-06-25 21:52:07 +0200
committerDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-06-25 21:52:07 +0200
commit9e3472ea9041b8755050427d8bdb8a4701019c55 (patch)
tree8f494a765a3607afd1c9bac9c592f30536b950a1 /matlab/mex
parentf1a8bd8d2b62b089a90fef55268e3300581717ed (diff)
downloadastra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.gz
astra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.bz2
astra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.xz
astra-9e3472ea9041b8755050427d8bdb8a4701019c55.zip
Fix memory leak in configuration code
Diffstat (limited to 'matlab/mex')
-rw-r--r--matlab/mex/astra_mex_projector3d_c.cpp8
-rw-r--r--matlab/mex/astra_mex_projector_c.cpp9
2 files changed, 12 insertions, 5 deletions
diff --git a/matlab/mex/astra_mex_projector3d_c.cpp b/matlab/mex/astra_mex_projector3d_c.cpp
index c3b547f..e25802c 100644
--- a/matlab/mex/astra_mex_projector3d_c.cpp
+++ b/matlab/mex/astra_mex_projector3d_c.cpp
@@ -137,7 +137,9 @@ void astra_mex_projector3d_get_projection_geometry(int nlhs, mxArray* plhs[], in
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getProjectionGeometry()->getConfiguration());
+ Config *cfg = pProjector->getProjectionGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
@@ -163,7 +165,9 @@ void astra_mex_projector3d_get_volume_geometry(int nlhs, mxArray* plhs[], int nr
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getVolumeGeometry()->getConfiguration());
+ Config *cfg = pProjector->getVolumeGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
diff --git a/matlab/mex/astra_mex_projector_c.cpp b/matlab/mex/astra_mex_projector_c.cpp
index 204ba8e..bf701af 100644
--- a/matlab/mex/astra_mex_projector_c.cpp
+++ b/matlab/mex/astra_mex_projector_c.cpp
@@ -160,7 +160,9 @@ void astra_mex_projector_projection_geometry(int nlhs, mxArray* plhs[], int nrhs
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getProjectionGeometry()->getConfiguration());
+ Config *cfg = pProjector->getProjectionGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
@@ -189,8 +191,9 @@ void astra_mex_projector_volume_geometry(int nlhs, mxArray* plhs[], int nrhs, co
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getVolumeGeometry()->getConfiguration());
-
+ Config *cfg = pProjector->getVolumeGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}