sdpsrc double frees memory during finalisation
It looks that sdpsrc tries to double free allocated memory during finalisation, when a sdp string is used instead of a file.
Example command line:
gst-launch-1.0 sdpsrc sdp="" ! fakesink
Output:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstSdpSrc:sdpsrc0/GstSDPDemux:sdpdemux0: Could not determine type of stream.
Additional debug info:
gstsdpdemux.c(1213): gst_sdp_demux_start (): /GstPipeline:pipeline0/GstSdpSrc:sdpsrc0/GstSDPDemux:sdpdemux0:
No streams in SDP message.
Execution ended after 0:00:00.000079045
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
double free or corruption (fasttop)
Aborted
Output with valgrind:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstSdpSrc:sdpsrc0/GstSDPDemux:sdpdemux0: Could not determine type of stream.
Additional debug info:
/docker-20.04-build/extract/gst-plugins-bad-1.14.5/gst/sdp/gstsdpdemux.c(1213): gst_sdp_demux_start (): /GstPipeline:pipeline0/GstSdpSrc:sdpsrc0/GstSDPDemux:sdpdemux0:
No streams in SDP message.
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
==165203== Invalid free() / delete / delete[] / realloc()
==165203== at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==165203== by 0x4A7523F: g_free (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libglib-2.0.so.0.4800.2)
==165203== by 0x4B584D2: gst_sdp_src_finalize (gstsdpsrc.c:57)
==165203== by 0x49D8788: g_object_unref (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== by 0x487E005: gst_object_unref (gstobject.c:266)
==165203== by 0x48865FB: gst_bin_remove_func (gstbin.c:1812)
==165203== by 0x4886A2C: gst_bin_remove (gstbin.c:1874)
==165203== by 0x4882CEA: gst_bin_dispose (gstbin.c:530)
==165203== by 0x48EC9C5: gst_pipeline_dispose (gstpipeline.c:252)
==165203== by 0x49D8690: g_object_unref (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== by 0x487E005: gst_object_unref (gstobject.c:266)
==165203== by 0x10C820: ??? (in /usr/bin/gst-launch-1.0)
==165203== Address 0x6af9150 is 0 bytes inside a block of size 2 free'd
==165203== at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==165203== by 0x4A7523F: g_free (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libglib-2.0.so.0.4800.2)
==165203== by 0x4881E40: default_free (gstallocator.c:527)
==165203== by 0x48817E8: gst_allocator_free (gstallocator.c:339)
==165203== by 0x48D44C7: _gst_memory_free (gstmemory.c:97)
==165203== by 0x48D5FD7: gst_mini_object_unref (gstminiobject.c:466)
==165203== by 0x488EAFE: gst_memory_unref (gstmemory.h:345)
==165203== by 0x4890270: _gst_buffer_free (gstbuffer.c:749)
==165203== by 0x48D5FD7: gst_mini_object_unref (gstminiobject.c:466)
==165203== by 0x4B58323: gst_buffer_unref (gstbuffer.h:442)
==165203== by 0x4B584AC: gst_sdp_src_finalize (gstsdpsrc.c:55)
==165203== by 0x49D8788: g_object_unref (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== Block was alloc'd at
==165203== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==165203== by 0x4A750E4: g_malloc (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libglib-2.0.so.0.4800.2)
==165203== by 0x4A753C7: g_malloc_n (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libglib-2.0.so.0.4800.2)
==165203== by 0x4A910C6: g_strdup (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libglib-2.0.so.0.4800.2)
==165203== by 0x49FB35D: g_value_dup_string (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== by 0x4B58660: gst_sdp_src_set_property (gstsdpsrc.c:94)
==165203== by 0x49D3EDD: object_set_property (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== by 0x49D6B9D: g_object_set_property (in /opt/xxx/3rd-party/gtkmm-3.18.1-15/lib/libgobject-2.0.so.0.4800.2)
==165203== by 0x4953178: gst_parse_element_set (grammar.y:441)
==165203== by 0x4956284: priv_gst_parse_yyparse (grammar.y:820)
==165203== by 0x4958CFF: priv_gst_parse_launch (grammar.y:1177)
==165203== by 0x494BE10: gst_parse_launch_full (gstparse.c:339)
==165203==
==165203==
==165203== HEAP SUMMARY:
==165203== in use at exit: 578,915 bytes in 2,628 blocks
==165203== total heap usage: 115,914 allocs, 113,287 frees, 13,058,786 bytes allocated
==165203==
==165203== LEAK SUMMARY:
==165203== definitely lost: 16,384 bytes in 1 blocks
==165203== indirectly lost: 0 bytes in 0 blocks
==165203== possibly lost: 4,708 bytes in 62 blocks
==165203== still reachable: 540,671 bytes in 2,420 blocks
==165203== of which reachable via heuristic:
==165203== length64 : 504 bytes in 12 blocks
==165203== newarray : 1,584 bytes in 19 blocks
==165203== suppressed: 0 bytes in 0 blocks
==165203== Rerun with --leak-check=full to see details of leaked memory
==165203==
==165203== For lists of detected and suppressed errors, rerun with: -s
==165203== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)