rtsp-media-factory: Don't cache any media if NULL was returned as key
authorSebastian Dröge <sebastian@centricular.com>
Mon, 25 Sep 2017 16:40:17 +0000 (19:40 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 25 Sep 2017 16:41:33 +0000 (19:41 +0300)
The docs already mentioned this, but we actually stored it in the hash
table with key==NULL and leaked its reference forever.

gst/rtsp-server/rtsp-media-factory.c

index cecb8a0..fd99298 100644 (file)
@@ -1216,7 +1216,7 @@ gst_rtsp_media_factory_construct (GstRTSPMediaFactory * factory,
           NULL);
 
       /* check if we can cache this media */
-      if (gst_rtsp_media_is_shared (media)) {
+      if (gst_rtsp_media_is_shared (media) && key) {
         /* insert in the hashtable, takes ownership of the key */
         g_object_ref (media);
         g_hash_table_insert (priv->medias, key, media);