Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e1e24358
Commit
e1e24358
authored
Jun 12, 2014
by
Sancho McCann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: Memory leak in deletion of er_stack nodes of ERFilter.
parent
14671e0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
erfilter.cpp
modules/objdetect/src/erfilter.cpp
+23
-1
No files found.
modules/objdetect/src/erfilter.cpp
View file @
e1e24358
...
...
@@ -42,6 +42,7 @@
#include "precomp.hpp"
#include <fstream>
#include <queue>
#if defined _MSC_VER && _MSC_VER == 1500
typedef
int
int_fast32_t
;
...
...
@@ -57,6 +58,27 @@ using namespace std;
namespace
cv
{
// Deletes a tree of ERStat regions starting at root. Used only
// internally to this implementation.
static
void
deleteERStatTree
(
ERStat
*
root
)
{
queue
<
ERStat
*>
to_delete
;
to_delete
.
push
(
root
);
while
(
!
to_delete
.
empty
())
{
ERStat
*
n
=
to_delete
.
front
();
to_delete
.
pop
();
ERStat
*
c
=
n
->
child
;
if
(
c
!=
NULL
)
{
to_delete
.
push
(
c
);
ERStat
*
sibling
=
c
->
next
;
while
(
sibling
!=
NULL
)
{
to_delete
.
push
(
sibling
);
sibling
=
sibling
->
next
;
}
}
delete
n
;
}
}
ERStat
::
ERStat
(
int
init_level
,
int
init_pixel
,
int
init_x
,
int
init_y
)
:
pixel
(
init_pixel
),
level
(
init_level
),
area
(
0
),
perimeter
(
0
),
euler
(
0
),
probability
(
1.0
),
parent
(
0
),
child
(
0
),
next
(
0
),
prev
(
0
),
local_maxima
(
0
),
...
...
@@ -497,7 +519,7 @@ void ERFilterNM::er_tree_extract( InputArray image )
delete
(
stat
->
crossings
);
stat
->
crossings
=
NULL
;
}
delete
stat
;
delete
ERStatTree
(
stat
)
;
}
er_stack
.
clear
();
...
...
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