riff-media: fix memory leak after usage for g_strjoin
authorhoonhee.lee <hoonhee.lee@lge.com>
Thu, 7 Apr 2022 01:08:37 +0000 (10:08 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 7 Apr 2022 20:36:42 +0000 (20:36 +0000)
This leak is observed with valgrind.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2129>

subprojects/gst-plugins-base/gst-libs/gst/riff/riff-media.c

index 4bb723b..21200a1 100644 (file)
@@ -1755,8 +1755,10 @@ gst_riff_create_audio_caps (guint16 codec_id,
             GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE audio");
           if (caps) {
             if (codec_name) {
+              gchar *tmp = *codec_name;
               GST_DEBUG ("WAVE_FORMAT_EXTENSIBLE %s", *codec_name);
-              *codec_name = g_strjoin ("wavext ", *codec_name, NULL);
+              *codec_name = g_strjoin ("wavext ", tmp, NULL);
+              g_free (tmp);
             }
             return caps;
           }