about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2013-01-13 02:41:49 +0200
committerDmitry Podgorny <pasis.ua@gmail.com>2013-01-13 02:41:49 +0200
commit76270fdca8014af021f478b818976fe7cb061782 (patch)
treecf482d7cf44416aea2774a8429c7c93da6afa6ba /src
parent3a22719bd7a59d0eaaa6206c7fd289825365b3ff (diff)
downloadprofani-tty-76270fdca8014af021f478b818976fe7cb061782.tar.gz
fixed memory leak in parse_room_jid
Diffstat (limited to 'src')
-rw-r--r--src/jid.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/jid.c b/src/jid.c
index 04c69636..90d225bc 100644
--- a/src/jid.c
+++ b/src/jid.c
@@ -121,18 +121,21 @@ jid_create_room_jid(const char * const room, const char * const nick)
 gboolean
 parse_room_jid(const char * const full_room_jid, char **room, char **nick)
 {
+    gboolean result = FALSE;
     char **tokens = g_strsplit(full_room_jid, "/", 0);
 
-    if (tokens == NULL || tokens[0] == NULL || tokens[1] == NULL) {
+    if (tokens == NULL)
         return FALSE;
-    } else {
+
+    if (tokens[0] != NULL && tokens[1] != NULL) {
         *room = strdup(tokens[0]);
         *nick = strdup(tokens[1]);
+        result = TRUE;
+    }
 
-        g_strfreev(tokens);
+    g_strfreev(tokens);
 
-        return TRUE;
-    }
+    return result;
 }
 
 /*