mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 22:58:16 +00:00
giosink: reflow error handling to not leak uri
This commit is contained in:
parent
60847e48d7
commit
e95bbca65f
1 changed files with 13 additions and 17 deletions
|
@ -245,7 +245,6 @@ gst_gio_sink_start (GstBaseSink * base_sink)
|
|||
GstGioSink *sink = GST_GIO_SINK (base_sink);
|
||||
GOutputStream *stream;
|
||||
GCancellable *cancel = GST_GIO_BASE_SINK (sink)->cancel;
|
||||
gboolean success;
|
||||
GError *err = NULL;
|
||||
gchar *uri;
|
||||
|
||||
|
@ -263,10 +262,8 @@ gst_gio_sink_start (GstBaseSink * base_sink)
|
|||
G_OUTPUT_STREAM (g_file_create (sink->file, G_FILE_CREATE_NONE, cancel,
|
||||
&err));
|
||||
|
||||
success = (stream != NULL);
|
||||
|
||||
if (!success && !gst_gio_error (sink, "g_file_create", &err, NULL)) {
|
||||
|
||||
if (!stream) {
|
||||
if (!gst_gio_error (sink, "g_file_create", &err, NULL)) {
|
||||
/*if (GST_GIO_ERROR_MATCHES (err, EXISTS)) */
|
||||
/* FIXME: Retry with replace if overwrite == TRUE! */
|
||||
|
||||
|
@ -277,12 +274,11 @@ gst_gio_sink_start (GstBaseSink * base_sink)
|
|||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_READ, (NULL),
|
||||
("Could not open location %s for writing: %s", uri, err->message));
|
||||
|
||||
g_free (uri);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
g_free (uri);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (sink, "opened location %s", uri);
|
||||
|
||||
|
|
Loading…
Reference in a new issue