kmssink: fix memory leak on failing allowed caps

When drm does not find any format, the allowed_caps is
empty one and need to be unref by the caller.

Fix #1268
This commit is contained in:
Stéphane Cerveau 2020-04-16 15:35:44 +02:00
parent 63940feaaf
commit 040077dbc8

View file

@ -568,12 +568,18 @@ ensure_allowed_caps (GstKMSSink * self, drmModeConnector * conn,
out_caps = gst_caps_merge (out_caps, gst_caps_simplify (tmp_caps));
}
if (gst_caps_is_empty (out_caps)) {
GST_DEBUG_OBJECT (self, "allowed caps is empty");
gst_caps_unref (out_caps);
return FALSE;
}
self->allowed_caps = gst_caps_simplify (out_caps);
GST_DEBUG_OBJECT (self, "allowed caps = %" GST_PTR_FORMAT,
self->allowed_caps);
return (self->allowed_caps && !gst_caps_is_empty (self->allowed_caps));
return TRUE;
}
static gboolean