diff --git a/gtk/spice-uri.c b/gtk/spice-uri.c
index c3790759ed67d5f3925c3dc4dabaeb222ecb6f56..cf6e71b86dedb69628c655c594f92a3a3154f35a 100644
--- a/gtk/spice-uri.c
+++ b/gtk/spice-uri.c
@@ -103,7 +103,7 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error)
 
     /* yes, that parser is bad, we need GUri... */
     if (strstr(uri, "@")) {
-        gchar *saveptr, *saveptr2;
+        gchar *saveptr = NULL, *saveptr2 = NULL;
         gchar *next = strstr(uri, "@") + 1;
         gchar *auth = strtok_r(uri, "@", &saveptr);
         const gchar *user = strtok_r(auth, ":", &saveptr2);