discoverer: don't crash on unknown info types when deserializing

Handle unknown info types when deserializing instead of
dereferencing NULL pointers.

Coverity CID 1302394
This commit is contained in:
Tim-Philipp Müller 2015-05-29 15:30:41 +01:00
parent 6ab46d8f0a
commit a24b9cd5c2

View file

@ -1875,7 +1875,8 @@ _parse_discovery (GVariant * variant, GstDiscovererInfo * info)
g_variant_get_child_value (specific, 0));
break;
default:
break;
GST_WARNING ("Unexpected discoverer info type %d", type);
goto out;
}
_parse_common_stream_info (sinfo, g_variant_get_child_value (common, 0));
@ -1895,13 +1896,17 @@ _parse_discovery (GVariant * variant, GstDiscovererInfo * info)
while ((child = g_variant_iter_next_value (&iter))) {
GstDiscovererStreamInfo *child_info;
child_info = _parse_discovery (g_variant_get_variant (child), info);
cinfo->streams =
g_list_append (cinfo->streams,
gst_discoverer_stream_info_ref (child_info));
if (child_info != NULL) {
cinfo->streams =
g_list_append (cinfo->streams,
gst_discoverer_stream_info_ref (child_info));
}
g_variant_unref (child);
}
}
out:
g_variant_unref (common);
g_variant_unref (specific);
g_variant_unref (variant);