Fix various unlikely, but still potential memoryleaks in error code paths

https://bugzilla.gnome.org/show_bug.cgi?id=667311
This commit is contained in:
Havard Graff 2011-11-01 17:57:59 +01:00 committed by Tim-Philipp Müller
parent b11d516c46
commit 95be60de15
6 changed files with 12 additions and 3 deletions

View file

@ -372,11 +372,13 @@ GstDiscovererInfo *
gst_discoverer_info_copy (GstDiscovererInfo * ptr) gst_discoverer_info_copy (GstDiscovererInfo * ptr)
{ {
GstDiscovererInfo *ret; GstDiscovererInfo *ret;
GHashTable *stream_map = g_hash_table_new (g_direct_hash, NULL); GHashTable *stream_map;
GList *tmp; GList *tmp;
g_return_val_if_fail (ptr != NULL, NULL); g_return_val_if_fail (ptr != NULL, NULL);
stream_map = g_hash_table_new (g_direct_hash, NULL);
ret = gst_discoverer_info_new (); ret = gst_discoverer_info_new ();
ret->uri = g_strdup (ptr->uri); ret->uri = g_strdup (ptr->uri);

View file

@ -501,6 +501,7 @@ gst_tag_freeform_string_to_utf8 (const gchar * data, gint size,
/* fallback in case iconv implementation doesn't support windows-1252 /* fallback in case iconv implementation doesn't support windows-1252
* for some reason */ * for some reason */
if (err->code == G_CONVERT_ERROR_NO_CONVERSION) { if (err->code == G_CONVERT_ERROR_NO_CONVERSION) {
g_free (utf8);
utf8 = g_convert (data, size, "UTF-8", "ISO-8859-1", &bytes_read, utf8 = g_convert (data, size, "UTF-8", "ISO-8859-1", &bytes_read,
NULL, NULL); NULL, NULL);
} }

View file

@ -1166,6 +1166,8 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
if (eclass->send_event) if (eclass->send_event)
eclass->send_event (GST_ELEMENT_CAST (basesrc), eclass->send_event (GST_ELEMENT_CAST (basesrc),
gst_event_new_tag (taglist)); gst_event_new_tag (taglist));
else
gst_tag_list_free (taglist);
src->tags_pushed = TRUE; src->tags_pushed = TRUE;
} }

View file

@ -644,9 +644,10 @@ gst_smart_encoder_find_elements (GstSmartEncoder * smart_encoder)
gst_caps_unref (tmpl); gst_caps_unref (tmpl);
if (gst_caps_is_empty (res)) if (gst_caps_is_empty (res)) {
gst_caps_unref (res);
ret = GST_STATE_CHANGE_FAILURE; ret = GST_STATE_CHANGE_FAILURE;
else } else
smart_encoder->available_caps = res; smart_encoder->available_caps = res;
GST_DEBUG_OBJECT (smart_encoder, "Done, available_caps:%" GST_PTR_FORMAT, GST_DEBUG_OBJECT (smart_encoder, "Done, available_caps:%" GST_PTR_FORMAT,

View file

@ -2867,6 +2867,7 @@ gst_play_sink_convert_frame (GstPlaySink * playsink, GstCaps * caps)
* on the bus or not. It's not like it's a critical issue regarding * on the bus or not. It's not like it's a critical issue regarding
* playsink behaviour. */ * playsink behaviour. */
GST_ERROR ("Error converting frame: %s", err->message); GST_ERROR ("Error converting frame: %s", err->message);
g_error_free (err);
} }
result = temp; result = temp;
} }

View file

@ -456,6 +456,8 @@ process_file (GstDiscoverer * dc, const gchar * filename)
g_print ("Analyzing %s\n", uri); g_print ("Analyzing %s\n", uri);
info = gst_discoverer_discover_uri (dc, uri, &err); info = gst_discoverer_discover_uri (dc, uri, &err);
print_info (info, err); print_info (info, err);
if (err)
g_error_free (err);
gst_discoverer_info_unref (info); gst_discoverer_info_unref (info);
if (st) if (st)
gst_structure_free (st); gst_structure_free (st);