Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
d125f685
Commit
d125f685
authored
Oct 18, 2018
by
Micha Mueller
Browse files
Fix possible memory leak
parent
c317f466
Changes
1
Show whitespace changes
Inline
Side-by-side
src/includes/ConfiguratorTemplate.h
View file @
d125f685
...
...
@@ -103,9 +103,11 @@ public:
auto
ret
=
_templateSensorEntitys
.
insert
(
std
::
pair
<
std
::
string
,
SEntity
*>
(
val
.
second
.
data
(),
entity
));
if
(
!
ret
.
second
)
{
LOG
(
warning
)
<<
"Template "
<<
_entityName
<<
" "
<<
val
.
second
.
data
()
<<
" already exists! Omitting..."
;
delete
entity
;
}
}
else
{
LOG
(
warning
)
<<
"Template "
<<
_entityName
<<
"
\"
"
<<
val
.
second
.
data
()
<<
"
\"
has bad values! Ignoring..."
;
delete
entity
;
}
}
//template group
...
...
@@ -117,9 +119,11 @@ public:
auto
ret
=
_templateSensorGroups
.
insert
(
std
::
pair
<
std
::
string
,
SGroup
*>
(
val
.
second
.
data
(),
group
));
if
(
!
ret
.
second
)
{
LOG
(
warning
)
<<
"Template "
<<
_groupName
<<
" "
<<
val
.
second
.
data
()
<<
" already exists! Omitting..."
;
delete
group
;
}
}
else
{
LOG
(
warning
)
<<
"Template "
<<
_groupName
<<
"
\"
"
<<
val
.
second
.
data
()
<<
"
\"
has bad values! Ignoring..."
;
delete
group
;
}
}
//entity
...
...
@@ -131,6 +135,7 @@ public:
_sensorEntitys
.
push_back
(
entity
);
}
else
{
LOG
(
warning
)
<<
_entityName
<<
"
\"
"
<<
val
.
second
.
data
()
<<
"
\"
has bad values! Ignoring..."
;
delete
entity
;
}
}
//group
...
...
@@ -142,6 +147,7 @@ public:
storeSensorGroup
(
group
);
}
else
{
LOG
(
warning
)
<<
_groupName
<<
"
\"
"
<<
val
.
second
.
data
()
<<
"
\"
has bad values! Ignoring..."
;
delete
group
;
}
}
}
...
...
@@ -287,6 +293,7 @@ protected:
sGroup
.
pushBackSensor
(
sensor
);
}
else
{
LOG
(
warning
)
<<
_baseName
<<
" "
<<
sGroup
.
getGroupName
()
<<
"::"
<<
sensor
->
getName
()
<<
" could not be read! Omitting"
;
delete
sensor
;
}
}
}
...
...
@@ -344,12 +351,14 @@ protected:
auto
ret
=
_templateSensorGroups
.
insert
(
std
::
pair
<
std
::
string
,
SGroup
*>
(
val
.
second
.
data
(),
group
));
if
(
!
ret
.
second
)
{
LOG
(
warning
)
<<
"Template "
<<
_groupName
<<
" "
<<
val
.
second
.
data
()
<<
" already exists! Omitting..."
;
delete
group
;
}
}
else
{
storeSensorGroup
(
group
);
}
}
else
{
LOG
(
warning
)
<<
_groupName
<<
" "
<<
group
->
getGroupName
()
<<
" could not be read! Omitting"
;
delete
group
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment