nvcodec: Mark class data as may-be-leaked to quiet the leaks tracer

The class data with the caps in it will be leaked if the element is
registered but never instantiated. There is no way around this. Mark
the caps as such so that the leaks tracer does not warn about it.

This is the same as pad template caps getting leaked, which are also
marked as may-be-leaked. These objects are initialized exactly once,
and are 'global' data.
This commit is contained in:
Nirbheek Chauhan 2020-02-12 00:00:51 +05:30
parent 9ac798ae5e
commit 266dc41596
3 changed files with 9 additions and 0 deletions

View file

@ -1413,6 +1413,9 @@ gst_nvdec_subclass_register (GstPlugin * plugin, GType type,
cdata->codec_type = codec_type;
cdata->codec = g_strdup (codec);
cdata->cuda_device_id = device_id;
/* class data will be leaked if the element never gets instantiated */
GST_MINI_OBJECT_FLAG_SET (sink_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
GST_MINI_OBJECT_FLAG_SET (src_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
g_type_query (type, &type_query);
memset (&type_info, 0, sizeof (type_info));

View file

@ -643,6 +643,9 @@ gst_nv_h264_enc_register (GstPlugin * plugin, guint device_id, guint rank,
cdata->sink_caps = gst_caps_ref (sink_caps);
cdata->src_caps = gst_caps_ref (src_caps);
type_info.class_data = cdata;
/* class data will be leaked if the element never gets instantiated */
GST_MINI_OBJECT_FLAG_SET (sink_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
GST_MINI_OBJECT_FLAG_SET (src_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
type_name = g_strdup ("GstNvH264Enc");
feature_name = g_strdup ("nvh264enc");

View file

@ -798,6 +798,9 @@ gst_nv_h265_enc_register (GstPlugin * plugin, guint device_id, guint rank,
cdata->sink_caps = gst_caps_ref (sink_caps);
cdata->src_caps = gst_caps_ref (src_caps);
type_info.class_data = cdata;
/* class data will be leaked if the element never gets instantiated */
GST_MINI_OBJECT_FLAG_SET (sink_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
GST_MINI_OBJECT_FLAG_SET (src_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
type_name = g_strdup ("GstNvH265Enc");
feature_name = g_strdup ("nvh265enc");