[vinagre/plugin] Double check if a plugin exists in vinagre_connection_new_from_string()



commit e59b2f42cfd2001721090f5ab4d6e11d3198a1c1
Author: Jonh Wendell <jwendell gnome org>
Date:   Fri Jul 24 09:59:38 2009 -0300

    Double check if a plugin exists in vinagre_connection_new_from_string()

 vinagre/vinagre-connection.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/vinagre/vinagre-connection.c b/vinagre/vinagre-connection.c
index a170827..eb9640f 100644
--- a/vinagre/vinagre-connection.c
+++ b/vinagre/vinagre-connection.c
@@ -598,14 +598,19 @@ vinagre_connection_new_from_string (const gchar *uri, gchar **error_msg, gboolea
 				     port);
   if (!conn)
     {
-      plugin = g_hash_table_lookup (vinagre_plugin_engine_get_plugins_by_protocol (vinagre_plugins_engine_get_default ()),
-				    protocol);
+      plugin = vinagre_plugins_engine_get_plugin_by_protocol (vinagre_plugins_engine_get_default (),
+							      protocol);
+      if (!plugin)
+	goto finalize;
+
       conn = vinagre_plugin_new_connection (plugin);
       vinagre_connection_set_host (conn, host);
       vinagre_connection_set_port (conn, port);
     }
 
+finalize:
   g_free (host);
+  g_free (protocol);
   return conn;
 }
 



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