[Spice-devel] [PATCH spice-gtk] channel: clear channel error after auth error

Marc-André Lureau marcandre.lureau at redhat.com
Tue Dec 16 09:33:12 PST 2014


When entered authentication details are wrong, spice-gtk will reset
channel error, which will result in the following warning:

(remote-viewer:20753): GLib-WARNING **: GError set over the top of a
previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL
before it's set.

Clear channel error after reporting authentication error.
---
 gtk/spice-channel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index c00bb42..fb7b0d5 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2180,8 +2180,10 @@ static gboolean spice_channel_delayed_unref(gpointer data)
 
     g_return_val_if_fail(c->coroutine.coroutine.exited == TRUE, FALSE);
 
-    if (c->state == SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION)
+    if (c->state == SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION) {
         g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_ERROR_AUTH);
+        g_clear_error(&c->error);
+    }
 
     g_object_unref(G_OBJECT(data));
 
-- 
2.1.0



More information about the Spice-devel mailing list