cap_libv4p.cpp leaks when USE_TEMP_BUFFER is set (Bug #1518)


Added by Georg Engstrand about 13 years ago. Updated over 12 years ago.


Status:Done Start date:
Priority:Blocker Due date:
Assignee:- % Done:

0%

Category:highgui-video
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Version: Latest on 2.3 svn branch
OS: Linux

When USE_TEMP_BUFFER is set (which it is now, at least on this branch) a temp buffer is allocated (malloc), but never freed. This happens at every initialization and became a problem for me in an application that switches alot between to camera resolutions.

I've attached a test program and a patch to fix the problem. The patch makes sure the buffer pointer is null at startup and frees it (and sets it to null) when deinit'ing or if it exists when allocing it.

The problem is very noticable when running valgrind --show-reachable=yes, as the allocated buffers are not reachable any longer.

Let me know if you need any more information to verify.


v4l-memleak-fix.diff - Fix for memleak in cap_libv4l.cpp (1.6 kB) Georg Engstrand, 2011-12-15 09:21 am

test-opencv-memleak.c - Test opencv v4l memleak (1.3 kB) Georg Engstrand, 2011-12-15 09:22 am


Associated revisions

Revision 403a7ff3
Added by Vadim Pisarevsky about 13 years ago

fixed memory leak in cap_libv4l.cpp (ticket #1518; thanks to gorgen for the patch)

Revision 8aa63af5
Added by Roman Donchenko over 11 years ago

Merge pull request #1518 from jet47:bug-3291-tbb-install

History

Updated by Vadim Pisarevsky about 13 years ago

thanks! your patch was applied in SVN, r7215

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Updated by Andrey Kamaev about 13 years ago

  • Target version set to 2.4.0

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-video

Also available in: Atom PDF