Fix for jid parsing.
--- a/disco.c Wed Nov 11 15:14:34 2009 +0200
+++ b/disco.c Sat Dec 12 01:24:18 2009 +0200
@@ -188,15 +188,18 @@
char *dnode = NULL;
if (args[0] && args[1]) {
- if (*args[1] == '.') {
- if (*(args[1] + 1) == JID_RESOURCE_SEPARATOR) { // allow "./resource" notation
- char *rest = to_utf8 (args[1] + 1);
+ char *p = args[1];
+
+ if (*p == '.') {
+ if (*(p + 1) == JID_RESOURCE_SEPARATOR) {
+ char *rest = to_utf8 (p + 1);
to = g_strdup_printf ("%s%s", CURRENT_JID, rest);
g_free (rest);
- }
+ } else if (*(p + 1))
+ to = to_utf8 (p);
} else
- to = to_utf8 (args[1]);
+ to = to_utf8 (p);
if (args[2])
dnode = to_utf8 (args[2]);
@@ -219,7 +222,8 @@
lm_message_unref (request);
if (dnode)
g_free (dnode);
- g_free (to);
+ if (to)
+ g_free (to);
}
free_arg_lst (args);