After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667300 - basesrc: fixes potential caps-memoryleak
basesrc: fixes potential caps-memoryleak
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Mac OS
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-04 20:05 UTC by Håvard Graff (hgr)
Modified: 2012-05-18 06:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.01 KB, patch)
2012-01-04 20:05 UTC, Håvard Graff (hgr)
reviewed Details | Review
patch (932 bytes, patch)
2012-01-12 23:33 UTC, Håvard Graff (hgr)
none Details | Review

Description Håvard Graff (hgr) 2012-01-04 20:05:44 UTC
Created attachment 204618 [details] [review]
patch

.
Comment 1 Vincent Penquerc'h 2012-01-09 10:45:34 UTC
It seems to me that there was no leak here. Am I missing something ?
This patch just repeats the peercaps test which was done before already.
Comment 2 Tim-Philipp Müller 2012-01-12 19:14:38 UTC
Comment on attachment 204618 [details] [review]
patch

I don't see the potential leak here either, and as far as I can tell the new version is functionally 100% equivalent to the old version.
Comment 3 Håvard Graff (hgr) 2012-01-12 19:27:57 UTC
What if peercaps == GST_CAPS_ANY ?

if (peercaps && !gst_caps_is_any (peercaps)) {
    /* get intersection */
    caps =
        gst_caps_intersect_full (peercaps, thiscaps, GST_CAPS_INTERSECT_FIRST);
    GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, caps);
    gst_caps_unref (peercaps);
  } else {
    /* no peer, work with our own caps then */
    caps = gst_caps_copy (thiscaps);
  }
}

It would go into the "else", and there peercaps would not be freed?
Comment 4 Tim-Philipp Müller 2012-01-12 19:45:16 UTC
Ah, yes. But the code upstream (both git and 0.10.35) is:

  2663	  /* get the peer caps */
  2664	  peercaps = gst_pad_peer_get_caps_reffed (GST_BASE_SRC_PAD (basesrc));
  2665	  GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps);
  2666	  if (peercaps) {
  2667	    /* get intersection */
  2668	    caps =
  2669	        gst_caps_intersect_full (peercaps, thiscaps, GST_CAPS_INTERSECT_FIRST);
  2670	    GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, caps);
  2671	    gst_caps_unref (peercaps);
  2672	  } else {
  2673	    /* no peer, work with our own caps then */
  2674	    caps = gst_caps_copy (thiscaps);
  2675	  }
  2676	  gst_caps_unref (thiscaps);
Comment 5 Håvard Graff (hgr) 2012-01-12 23:33:42 UTC
Created attachment 205151 [details] [review]
patch

basesrc: minor negotiation optimization
Comment 6 Håvard Graff (hgr) 2012-01-12 23:34:51 UTC
I see what has happen. I forgot about a local modification that speeds up caps-nego a bit (attached), and hence the diverge... Sorry about that.
Comment 7 Wim Taymans 2012-05-18 06:33:54 UTC
in 0.11 the intersection uses refcounting instead of copy and the filter is done in the getcaps call. For 0.10, I wonder if it is still worth it..
Comment 8 Wim Taymans 2012-05-18 06:40:49 UTC
In fact, intersect also just does a copy when caps2 is ANY so this patch doesn't reduce any complexity. closing.