[rhythmbox] encoder: fix double free of error information



commit d349386c0987418e4208bae1136946f29efd0060
Author: Jonathan Matthew <jonathan d14n org>
Date:   Mon May 31 12:41:25 2010 +1000

    encoder: fix double free of error information

 backends/gstreamer/rb-encoder-gst.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/backends/gstreamer/rb-encoder-gst.c b/backends/gstreamer/rb-encoder-gst.c
index 631aa39..8ab920e 100644
--- a/backends/gstreamer/rb-encoder-gst.c
+++ b/backends/gstreamer/rb-encoder-gst.c
@@ -219,16 +219,12 @@ set_error (RBEncoderGst *encoder, GError *error)
 
 	/* translate some GStreamer errors into generic ones */
 	if (g_error_matches (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NO_SPACE_LEFT)) {
-		GError *old = error;
-		error = g_error_new (RB_ENCODER_ERROR, RB_ENCODER_ERROR_OUT_OF_SPACE, "%s", old->message);
-		g_error_free (old);
+		encoder->priv->error = g_error_new (RB_ENCODER_ERROR, RB_ENCODER_ERROR_OUT_OF_SPACE, "%s", error->message);
 	} else if (g_error_matches (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_OPEN_WRITE)) {
-		GError *old = error;
-		error = g_error_new (RB_ENCODER_ERROR, RB_ENCODER_ERROR_DEST_READ_ONLY, "%s", old->message);
-		g_error_free (old);
+		encoder->priv->error = g_error_new (RB_ENCODER_ERROR, RB_ENCODER_ERROR_DEST_READ_ONLY, "%s", error->message);
+	} else {
+		encoder->priv->error = g_error_copy (error);
 	}
-
-	g_propagate_error (&encoder->priv->error, error);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]