From 3c5aa0a78624880267cb2e62ea6538a76b220b06 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 4 Oct 2017 19:41:58 +0200 Subject: [PATCH] alsamidisrc: Fix a memory leak when setting the "ports" property When setting the "ports" property the value is duplicated but it's not freed when the elements stops. Reported by Valgrind (example run with "alsamidisrc ports=128:0"): 6 bytes in 1 blocks are definitely lost in loss record 30 of 1,911 at 0x4C2BBEF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5411528: g_malloc (gmem.c:94) by 0x542A9FE: g_strdup (gstrfuncs.c:363) by 0x775211E: gst_alsa_midi_src_set_property (gstalsamidisrc.c:284) by 0x5184A4D: object_set_property (gobject.c:1439) by 0x5184A4D: g_object_setv (gobject.c:2245) by 0x51859DD: g_object_set_property (gobject.c:2529) by 0x4F0474C: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0) by 0x4F065C8: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0) by 0x4F07557: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0) by 0x4EFE3EE: gst_parse_launch_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0) by 0x4EFE673: gst_parse_launchv_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0) https://bugzilla.gnome.org/show_bug.cgi?id=787683 --- ext/alsa/gstalsamidisrc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/alsa/gstalsamidisrc.c b/ext/alsa/gstalsamidisrc.c index 2423826e45..31227c8dcb 100644 --- a/ext/alsa/gstalsamidisrc.c +++ b/ext/alsa/gstalsamidisrc.c @@ -517,6 +517,7 @@ gst_alsa_midi_src_stop (GstBaseSrc * basesrc) alsamidisrc = GST_ALSA_MIDI_SRC (basesrc); + g_free (alsamidisrc->ports); g_free (alsamidisrc->pfds); g_free (alsamidisrc->buffer); snd_midi_event_free (alsamidisrc->parser);