GNOME Bugzilla – Bug 796830
webrtcbin: Memory leak when validating SDP
Last modified: 2018-07-19 17:40:26 UTC
Created attachment 373086 [details] [review] patch fix The GError after validating the SDP doesn't get freed. Found when running a webrtcbin pipeline inside valgrind: ==5764== 176 (32 direct, 144 indirect) bytes in 2 blocks are definitely lost in loss record 3,017 of 3,165 ==5764== at 0x402E110: malloc (vg_replace_malloc.c:299) ==5764== by 0x4A84FE8: g_malloc (gmem.c:94) ==5764== by 0x4AA1B1F: g_slice_alloc (gslice.c:1025) ==5764== by 0x4A6421B: g_error_new_valist (gerror.c:408) ==5764== by 0x4A645D3: g_set_error (gerror.c:582) ==5764== by 0x7A8E4B0: _check_valid_state_for_sdp_change (webrtcsdp.c:88) ==5764== by 0x7A8E4B0: validate_sdp (webrtcsdp.c:291) ==5764== by 0x7A867AE: _set_description_task (gstwebrtcbin.c:2293) ==5764== by 0x7A7E9A9: _execute_op (gstwebrtcbin.c:580) ==5764== by 0x4A7E90C: g_main_dispatch (gmain.c:3201) ==5764== by 0x4A7E90C: g_main_context_dispatch (gmain.c:3854) ==5764== by 0x4A7ECC7: g_main_context_iterate.isra.29 (gmain.c:3927) ==5764== by 0x4A7EFE1: g_main_loop_run (gmain.c:4123) ==5764== by 0x7A7EAF9: _gst_pc_thread (gstwebrtcbin.c:531)
Thanks for the patch, pushed: commit 1b095e9609ef6f4a197c1fcfa662c4dc6fcea219 (HEAD -> master) Author: Sam Gigliotti <samgig@amazon.com> Date: Wed Jul 18 14:26:17 2018 +0100 webrtc: fix memory leak When it parses SDP, it doesn't free the error object. https://bugzilla.gnome.org/show_bug.cgi?id=796830 I changed the g_error_free() to a g_clear_error() so the error gets NULL-ed as well (makes it more resilient to future code changes).
Thanks Tim! :)