Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
41b26fc4
Commit
41b26fc4
authored
Nov 28, 2012
by
JINMEI Tatuya
Browse files
[2420] unify destroying zone data and leak check in the test dtor
parent
bb38dbf0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/tests/memory/zone_data_updater_unittest.cc
View file @
41b26fc4
...
...
@@ -45,12 +45,16 @@ protected:
zone_data_
(
ZoneData
::
create
(
mem_sgmt_
,
zname_
)),
updater_
(
new
ZoneDataUpdater
(
mem_sgmt_
,
zclass_
,
zname_
,
*
zone_data_
))
{}
~
ZoneDataUpdaterTest
()
{
// Make sure zone data is destroyed even if a test results in exception
if
(
zone_data_
!=
NULL
)
{
ZoneData
::
destroy
(
mem_sgmt_
,
zone_data_
,
zclass_
);
}
if
(
!
mem_sgmt_
.
allMemoryDeallocated
())
{
ADD_FAILURE
()
<<
"Memory leak detected"
;
}
}
void
clearZoneData
()
{
assert
(
zone_data_
!=
NULL
);
ZoneData
::
destroy
(
mem_sgmt_
,
zone_data_
,
zclass_
);
...
...
@@ -59,13 +63,6 @@ protected:
*
zone_data_
));
}
void
TearDown
()
{
if
(
zone_data_
!=
NULL
)
{
ZoneData
::
destroy
(
mem_sgmt_
,
zone_data_
,
zclass_
);
zone_data_
=
NULL
;
}
EXPECT_TRUE
(
mem_sgmt_
.
allMemoryDeallocated
());
// catch any leak here.
}
const
Name
zname_
;
const
RRClass
zclass_
;
test
::
MemorySegmentTest
mem_sgmt_
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment