mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 09:36:22 +00:00
Fix memory leak in cmd_join()
room is either argv[0] or allocated by GString. We have to free memory in the 2nd case. Replace argv[0] with g_strdup(argv[0]) in order to make unconditional g_free().
This commit is contained in:
@@ -3606,7 +3606,7 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
// full room jid supplied (room@server)
|
// full room jid supplied (room@server)
|
||||||
if (room_arg->localpart) {
|
if (room_arg->localpart) {
|
||||||
room = args[0];
|
room = g_strdup(args[0]);
|
||||||
|
|
||||||
// server not supplied (room), use account preference
|
// server not supplied (room), use account preference
|
||||||
} else if (account->muc_service) {
|
} else if (account->muc_service) {
|
||||||
@@ -3631,6 +3631,7 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
g_free(room);
|
||||||
jid_destroy(room_arg);
|
jid_destroy(room_arg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -3657,6 +3658,7 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
ui_switch_to_room(room);
|
ui_switch_to_room(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free(room);
|
||||||
jid_destroy(room_arg);
|
jid_destroy(room_arg);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user