Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Usgscsm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
5c98921d
Commit
5c98921d
authored
4 years ago
by
Jesse Mapel
Browse files
Options
Downloads
Patches
Plain Diff
Fixed memory leaks in Plugin methods
parent
51bc20aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/UsgsAstroPlugin.cpp
+14
-3
14 additions, 3 deletions
src/UsgsAstroPlugin.cpp
with
14 additions
and
3 deletions
src/UsgsAstroPlugin.cpp
+
14
−
3
View file @
5c98921d
...
...
@@ -123,7 +123,10 @@ bool UsgsAstroPlugin::canModelBeConstructedFromState(
csm
::
WarningList
*
warnings
)
const
{
try
{
csm
::
Model
*
model
=
constructModelFromState
(
modelState
,
warnings
);
return
static_cast
<
bool
>
(
model
);
if
(
model
)
{
delete
model
;
return
true
;
}
}
catch
(
std
::
exception
&
e
)
{
std
::
string
msg
=
"Could not create model ["
;
msg
+=
modelName
;
...
...
@@ -157,7 +160,10 @@ bool UsgsAstroPlugin::canModelBeConstructedFromISD(
try
{
csm
::
Model
*
model
=
constructModelFromISD
(
imageSupportData
,
modelName
,
warnings
);
return
static_cast
<
bool
>
(
model
);
if
(
model
)
{
delete
model
;
return
true
;
}
}
catch
(
std
::
exception
&
e
)
{
if
(
warnings
)
{
std
::
string
msg
=
"Could not create model ["
;
...
...
@@ -273,7 +279,9 @@ std::string UsgsAstroPlugin::convertISDToModelState(
MESSAGE_LOG
(
"Running convertISDToModelState"
);
csm
::
Model
*
sensor_model
=
constructModelFromISD
(
imageSupportData
,
modelName
,
warnings
);
return
sensor_model
->
getModelState
();
std
::
string
stateString
=
sensor_model
->
getModelState
();
delete
sensor_model
;
return
stateString
;
}
csm
::
Model
*
UsgsAstroPlugin
::
constructModelFromISD
(
...
...
@@ -291,6 +299,7 @@ csm::Model *UsgsAstroPlugin::constructModelFromISD(
model
->
constructStateFromIsd
(
stringIsd
,
warnings
));
MESSAGE_LOG
(
"Constructed model: {}"
,
modelName
);
}
catch
(
std
::
exception
&
e
)
{
delete
model
;
csm
::
Error
::
ErrorType
aErrorType
=
csm
::
Error
::
SENSOR_MODEL_NOT_CONSTRUCTIBLE
;
std
::
string
aMessage
=
"Could not construct model ["
;
...
...
@@ -310,6 +319,7 @@ csm::Model *UsgsAstroPlugin::constructModelFromISD(
model
->
replaceModelState
(
model
->
constructStateFromIsd
(
stringIsd
,
warnings
));
}
catch
(
std
::
exception
&
e
)
{
delete
model
;
csm
::
Error
::
ErrorType
aErrorType
=
csm
::
Error
::
SENSOR_MODEL_NOT_CONSTRUCTIBLE
;
std
::
string
aMessage
=
"Could not construct model ["
;
...
...
@@ -329,6 +339,7 @@ csm::Model *UsgsAstroPlugin::constructModelFromISD(
model
->
replaceModelState
(
model
->
constructStateFromIsd
(
stringIsd
,
warnings
));
}
catch
(
std
::
exception
&
e
)
{
delete
model
;
csm
::
Error
::
ErrorType
aErrorType
=
csm
::
Error
::
SENSOR_MODEL_NOT_CONSTRUCTIBLE
;
std
::
string
aMessage
=
"Could not construct model ["
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment