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
403a7ff3
Commit
403a7ff3
authored
Jan 26, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed memory leak in cap_libv4l.cpp (ticket #1518; thanks to gorgen for the patch)
parent
951a3d6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
cap_libv4l.cpp
modules/highgui/src/cap_libv4l.cpp
+18
-3
No files found.
modules/highgui/src/cap_libv4l.cpp
View file @
403a7ff3
...
...
@@ -821,8 +821,13 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
#ifdef USE_TEMP_BUFFER
if
(
n_buffers
==
0
)
{
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
=
malloc
(
buf
.
length
);
capture
->
buffers
[
MAX_V4L_BUFFERS
].
length
=
buf
.
length
;
if
(
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
)
{
free
(
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
);
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
=
NULL
;
}
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
=
malloc
(
buf
.
length
);
capture
->
buffers
[
MAX_V4L_BUFFERS
].
length
=
buf
.
length
;
};
#endif
}
...
...
@@ -1006,6 +1011,10 @@ static CvCaptureCAM_V4L * icvCaptureFromCAM_V4L (int index)
capture
->
width
=
DEFAULT_V4L_WIDTH
;
capture
->
height
=
DEFAULT_V4L_HEIGHT
;
#ifdef USE_TEMP_BUFFER
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
=
NULL
;
#endif
/* Select camera, or rather, V4L video source */
if
(
index
<
0
)
{
// Asking for the first device available
for
(;
autoindex
<
MAX_CAMERAS
;
autoindex
++
)
...
...
@@ -1184,7 +1193,6 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
}
/* preparation is ok */
capture
->
FirstCapture
=
0
;
}
...
...
@@ -1694,6 +1702,13 @@ static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture ){
if
(
capture
->
frame
.
imageData
)
cvFree
(
&
capture
->
frame
.
imageData
);
#ifdef USE_TEMP_BUFFER
if
(
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
)
{
free
(
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
);
capture
->
buffers
[
MAX_V4L_BUFFERS
].
start
=
NULL
;
}
#endif
//v4l2_free_ranges(capture);
//cvFree((void **)capture);
}
...
...
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