validate: descriptor-writer: Handle NULL GError address and free GError during error cases

writer_new_discover() API should be able to accept NULL GError and in case of
error, if GError is passed on as parameter, it should be propagated, else it
should be free'd.

https://bugzilla.gnome.org/show_bug.cgi?id=753340
This commit is contained in:
Vineeth TM 2015-08-17 10:31:33 +09:00 committed by Thibault Saunier
parent 5c0c42ed6d
commit 15c87003b8

View file

@ -515,19 +515,21 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
GstMediaDescriptorWriter *writer = NULL; GstMediaDescriptorWriter *writer = NULL;
GstMediaDescriptor *media_descriptor; GstMediaDescriptor *media_descriptor;
const GstTagList *tags; const GstTagList *tags;
GError *error = NULL;
discoverer = gst_discoverer_new (GST_SECOND * 60, err); discoverer = gst_discoverer_new (GST_SECOND * 60, &error);
if (discoverer == NULL) { if (discoverer == NULL) {
GST_ERROR ("Could not create discoverer"); GST_ERROR ("Could not create discoverer");
g_propagate_error (err, error);
return NULL; return NULL;
} }
info = gst_discoverer_discover_uri (discoverer, uri, err); info = gst_discoverer_discover_uri (discoverer, uri, &error);
if (info == NULL && err && *err) {
GST_ERROR ("Could not discover URI: %s (error: %s)", uri, (*err)->message);
if (error) {
GST_ERROR ("Could not discover URI: %s (error: %s)", uri, error->message);
g_propagate_error (err, error);
goto out; goto out;
} else { } else {
GstDiscovererResult result = gst_discoverer_info_get_result (info); GstDiscovererResult result = gst_discoverer_info_get_result (info);