Your message dated Sun, 1 Nov 2009 21:28:59 +0100
with message-id <[email protected]>
and subject line dvgrab have memory errors with USB DV device on termination
has caused the Debian Bug report #509122,
regarding dvgrab have memory errors with USB DV device on termination
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
509122: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=509122
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dvgrab
Version: 3.2-2
Severity: important
Tags: patch

When grabbing video from my Panasonic NV-GS230 camera using a backport
of version 3.2-2 in Lenny, valgrind report errors when the grabbing is
terminated using ^C.  This is the output after building dvgrab with
the nostrip option to get debug output.

==11137== Memcheck, a memory error detector.
==11137== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==11137== Using LibVEX rev 1854, a library for dynamic binary translation.
==11137== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==11137== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation 
framework.
==11137== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==11137== For more details, rerun with: -v
==11137== 
Warning: Cannot set RR-scheduler
Warning: Cannot disable swapping
Capture Started
"/tmp/foo004.dv":     7.00 MiB 51 frames timecode 00:00:00.00 date 2008.12.18 
17:22:29
Capture Stopped
==11137== Invalid read of size 4
==11137==    at 0x80780C8: v4l2Reader::Close() (v4l2reader.cc:117)
==11137==    by 0x807850C: v4l2Reader::~v4l2Reader() (v4l2reader.cc:56)
==11137==    by 0x80556F7: DVgrab::cleanup() (dvgrab.cc:1306)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)
==11137==  Address 0x526dfa4 is 4 bytes inside a block of size 32 free'd
==11137==    at 0x4022B8A: free (vg_replace_malloc.c:323)
==11137==    by 0x80780EE: v4l2Reader::Close() (v4l2reader.cc:120)
==11137==    by 0x8077FDC: v4l2Reader::StopThread() (v4l2reader.cc:192)
==11137==    by 0x80556D0: DVgrab::cleanup() (dvgrab.cc:1304)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)
==11137== 
==11137== Invalid read of size 4
==11137==    at 0x80780CF: v4l2Reader::Close() (v4l2reader.cc:117)
==11137==    by 0x807850C: v4l2Reader::~v4l2Reader() (v4l2reader.cc:56)
==11137==    by 0x80556F7: DVgrab::cleanup() (dvgrab.cc:1306)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)
==11137==  Address 0x526dfa0 is 0 bytes inside a block of size 32 free'd
==11137==    at 0x4022B8A: free (vg_replace_malloc.c:323)
==11137==    by 0x80780EE: v4l2Reader::Close() (v4l2reader.cc:120)
==11137==    by 0x8077FDC: v4l2Reader::StopThread() (v4l2reader.cc:192)
==11137==    by 0x80556D0: DVgrab::cleanup() (dvgrab.cc:1304)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)
==11137== 
==11137== Invalid free() / delete / delete[]
==11137==    at 0x4022B8A: free (vg_replace_malloc.c:323)
==11137==    by 0x80780EE: v4l2Reader::Close() (v4l2reader.cc:120)
==11137==    by 0x807850C: v4l2Reader::~v4l2Reader() (v4l2reader.cc:56)
==11137==    by 0x80556F7: DVgrab::cleanup() (dvgrab.cc:1306)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)
==11137==  Address 0x526dfa0 is 0 bytes inside a block of size 32 free'd
==11137==    at 0x4022B8A: free (vg_replace_malloc.c:323)
==11137==    by 0x80780EE: v4l2Reader::Close() (v4l2reader.cc:120)
==11137==    by 0x8077FDC: v4l2Reader::StopThread() (v4l2reader.cc:192)
==11137==    by 0x80556D0: DVgrab::cleanup() (dvgrab.cc:1304)
==11137==    by 0x8055786: DVgrab::~DVgrab() (dvgrab.cc:157)
==11137==    by 0x8070469: main (main.cc:135)

==11137== 
==11137== ERROR SUMMARY: 9 errors from 3 contexts (suppressed: 61 from 1)
==11137== malloc/free: in use at exit: 35,216 bytes in 101 blocks.
==11137== malloc/free: 1,152 allocs, 1,052 frees, 113,716,869 bytes allocated.
==11137== For counts of detected errors, rerun with: -v
==11137== searching for pointers to 101 not-freed blocks.
==11137== checked 25,520,588 bytes.
==11137== 
==11137== LEAK SUMMARY:
==11137==    definitely lost: 0 bytes in 0 blocks.
==11137==      possibly lost: 0 bytes in 0 blocks.
==11137==    still reachable: 35,216 bytes in 101 blocks.
==11137==         suppressed: 0 bytes in 0 blocks.
==11137== Rerun with --leak-check=full to see details of leaked memory.

I believe this patch solve the issue:

diff -ur dvgrab-3.2/v4l2reader.cc dvgrab-3.2-pere/v4l2reader.cc
--- dvgrab-3.2/v4l2reader.cc    2008-02-27 04:31:52.000000000 +0100
+++ dvgrab-3.2-pere/v4l2reader.cc       2008-12-18 17:33:52.000000000 +0100
@@ -113,12 +113,21 @@
 void v4l2Reader::Close( void )
 {
        // Release mmaped buffers
-       for ( unsigned int i = 0; i < m_bufferCount; i++ )
-               munmap( m_buffers[i].start, m_buffers[i].length );
-
-       // Release mmap buffers tracking list
-       free( m_buffers );
+       if ( m_buffers )
+       {
+               for ( unsigned int i = 0; i < m_bufferCount; i++ )
+               {
+                       if ( m_buffers[i].start )
+                       {
+                               munmap( m_buffers[i].start, m_buffers[i].length 
);
+                               m_buffers[i].start = 0;
+                       }
+               }
 
+               // Release mmap buffers tracking list
+               free( m_buffers );
+               m_buffers = 0;
+       }
        // Close device file
        if ( m_fd > -1 )
        {


Happy hacking,
-- 
Petter Reinholdtsen



--- End Message ---
--- Begin Message ---
Version: 3.4-1

This was fixed upstream.


Bye,

Erik


-- 
 www.ErikSchanze.de *********************************************
 Bitte keine HTML-E-Mails! No HTML mails, please! Limit: 100 kB *
         - Linux-Info-Tag in Dresden auch 2010 wieder           *
             Info: http://www.linux-info-tag.de/                *


--- End Message ---

Reply via email to