mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge pull request #134 from pasis/fixes
fixed memory leak in parse_room_jid
This commit is contained in:
commit
0827ac344f
15
src/jid.c
15
src/jid.c
@ -121,18 +121,21 @@ jid_create_room_jid(const char * const room, const char * const nick)
|
|||||||
gboolean
|
gboolean
|
||||||
parse_room_jid(const char * const full_room_jid, char **room, char **nick)
|
parse_room_jid(const char * const full_room_jid, char **room, char **nick)
|
||||||
{
|
{
|
||||||
|
gboolean result = FALSE;
|
||||||
char **tokens = g_strsplit(full_room_jid, "/", 0);
|
char **tokens = g_strsplit(full_room_jid, "/", 0);
|
||||||
|
|
||||||
if (tokens == NULL || tokens[0] == NULL || tokens[1] == NULL) {
|
if (tokens == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
|
||||||
|
if (tokens[0] != NULL && tokens[1] != NULL) {
|
||||||
*room = strdup(tokens[0]);
|
*room = strdup(tokens[0]);
|
||||||
*nick = strdup(tokens[1]);
|
*nick = strdup(tokens[1]);
|
||||||
|
result = TRUE;
|
||||||
g_strfreev(tokens);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_strfreev(tokens);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user