[gst-devel] Failed to free the memory allocated by gst_pad_alloc_buffer_and_set_caps()

Edward Hervey bilboed at gmail.com
Thu Aug 5 08:54:44 CEST 2010


On Wed, 2010-08-04 at 20:33 +0800, Hu, Gang A wrote:
> Hi,
> I had a v4l2 camera driver with the “V4L2_MEMORY_USERPTR” type memory
> support and a camera source element “v4l2newcamsrc” to support this
> type memory. 
> When I running the pipeline bellow
> “gst-launch v4l2newcamsrc num-buffers=1 ! ffmpegcolorspace !
> video/x-raw-yuv,width=640,height=480 ! filesink
> location=image_640.yuv”
> The image can be captured successfully. 
> But when the buffers are freed in the camera source element, there
> will always be an error message in the terminal.
>  
> *** glibc detected *** /usr/local/meego/bin/gst-launch-0.10: free():
> invalid pointer: 0xb73c8008 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0x550cc1]
> /usr/local/meego/lib/libgstreamer-0.10.so.0(+0x29c06)[0xb7792c06]
> /usr/local/meego/lib/libgstreamer-0.10.so.0(gst_mini_object_unref
> +0xaf)[0xb77b94df]

  You've cut the backtrace too early so we can't say who called that
last buffer unref.

> .
>  
> I use gst_pad_alloc_buffer_and_set_caps() to allocate the buffer from
> the download element in the camera source element. 
> When the application exit, gst_buffer_unref (buffer) will be called to
> free the memory. This code case the error above after debugging with
> GDB.
>  
> I have two questions about that.
>      1. Which element is responsible for the memory allocation when
>         call “gst_pad_alloc_buffer_and_set_caps()” in camera source
>         element in my pipeline.

    An element downstream (you didn't provide your pipeline, so we can't
tell you).

>      1. How to free the memory allocated by
>         “gst_pad_alloc_buffer_and_set_caps()”? Why the error “free():
>         invalid pointer: 0xb73c8008 ***” occurred.

    This seems a bit weird. Don't you get any other error before this ?
If it was a double-free (or double unref), you would see a message
stating that.
    What is most likely happening (I'm just guessing because I have no
idea what your pipeline looks like or what your v4l2newcamsrc code looks
like) is one of the following:
    * you are calling gst_buffer_unref on a buffer you already passed
downstream
    * OR you are doing a free on the GST_BUFFER_DATA field of the buffer
that downstream returned (you shouldn't do that, that memory location is
handled by GstBuffer).

  You should figure out where that data you're trying to free was
already freed by using valgrind.

    Edward

>  
>  
>  
> Thanks.
> Best Regards!
> Hu Gang
>  
>  
>  
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________ gstreamer-devel mailing list gstreamer-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gstreamer-devel






More information about the gstreamer-devel mailing list