Fixed various memory leaks
This commit is contained in:
@@ -2348,16 +2348,15 @@ _form_field_autocomplete(char *input, int *size)
|
||||
if (((g_strcmp0(split[1], "add") == 0) || (g_strcmp0(split[1], "remove") == 0))
|
||||
&& field_type == FIELD_LIST_MULTI) {
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, value_ac, TRUE);
|
||||
g_string_free(beginning, TRUE);
|
||||
|
||||
} else if ((g_strcmp0(split[1], "remove") == 0) && field_type == FIELD_TEXT_MULTI) {
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, value_ac, TRUE);
|
||||
g_string_free(beginning, TRUE);
|
||||
|
||||
} else if ((g_strcmp0(split[1], "remove") == 0) && field_type == FIELD_JID_MULTI) {
|
||||
found = autocomplete_param_with_ac(input, size, beginning->str, value_ac, TRUE);
|
||||
g_string_free(beginning, TRUE);
|
||||
}
|
||||
|
||||
g_string_free(beginning, TRUE);
|
||||
}
|
||||
|
||||
} else if (g_strv_length(split) == 2) {
|
||||
|
||||
@@ -2077,15 +2077,15 @@ cmd_form(gchar **args, struct cmd_help_t help)
|
||||
iq_submit_room_config(room, current->form);
|
||||
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "cancel") == 0) {
|
||||
iq_room_config_cancel(room);
|
||||
}
|
||||
if ((g_strcmp0(args[0], "submit") == 0) ||
|
||||
(g_strcmp0(args[0], "cancel") == 0)) {
|
||||
|
||||
if ((g_strcmp0(args[0], "submit") == 0) || (g_strcmp0(args[0], "cancel") == 0)) {
|
||||
if (current->form) {
|
||||
cmd_autocomplete_remove_form_fields(current->form);
|
||||
}
|
||||
|
||||
wins_close_current();
|
||||
current = wins_get_by_recipient(room);
|
||||
if (current == NULL) {
|
||||
@@ -2474,6 +2474,7 @@ cmd_rooms(gchar **args, struct cmd_help_t help)
|
||||
if (args[0] == NULL) {
|
||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
||||
iq_room_list_request(account->muc_service);
|
||||
account_free(account);
|
||||
} else {
|
||||
iq_room_list_request(args[0]);
|
||||
}
|
||||
|
||||
@@ -739,6 +739,7 @@ _cons_show_account(ProfAccount *account)
|
||||
win_save_vprint(console, '-', NULL, NO_DATE, 0, "", "");
|
||||
Jid *jidp = jid_create_from_bare_and_resource(account->jid, resource->name);
|
||||
Capabilities *caps = caps_lookup(jidp->fulljid);
|
||||
jid_destroy(jidp);
|
||||
|
||||
if (caps != NULL) {
|
||||
// show identity
|
||||
|
||||
@@ -1519,7 +1519,7 @@ _ui_show_room_disco_info(const char * const room, GSList *identities, GSList *fe
|
||||
identity_str = g_string_append(identity_str, identity->category);
|
||||
}
|
||||
win_save_print(window, '!', NULL, 0, 0, "", identity_str->str);
|
||||
g_string_free(identity_str, FALSE);
|
||||
g_string_free(identity_str, TRUE);
|
||||
identities = g_slist_next(identities);
|
||||
}
|
||||
|
||||
|
||||
@@ -264,6 +264,7 @@ win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occup
|
||||
|
||||
Jid *jidp = jid_create_from_bare_and_resource(room, occupant->nick);
|
||||
Capabilities *caps = caps_lookup(jidp->fulljid);
|
||||
jid_destroy(jidp);
|
||||
|
||||
if (caps) {
|
||||
// show identity
|
||||
@@ -378,6 +379,7 @@ win_show_info(ProfWin *window, PContact contact)
|
||||
|
||||
Jid *jidp = jid_create_from_bare_and_resource(barejid, resource->name);
|
||||
Capabilities *caps = caps_lookup(jidp->fulljid);
|
||||
jid_destroy(jidp);
|
||||
|
||||
if (caps) {
|
||||
// show identity
|
||||
|
||||
@@ -453,9 +453,9 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
_connection_free_saved_details();
|
||||
}
|
||||
|
||||
Jid *myJid = jid_create(jabber_get_fulljid());
|
||||
jabber_conn.domain = strdup(myJid->domainpart);
|
||||
jid_destroy(myJid);
|
||||
Jid *my_jid = jid_create(jabber_get_fulljid());
|
||||
jabber_conn.domain = strdup(my_jid->domainpart);
|
||||
jid_destroy(my_jid);
|
||||
|
||||
chat_sessions_init();
|
||||
|
||||
|
||||
@@ -458,6 +458,8 @@ _form_tag_exists(DataForm *form, const char * const tag)
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free(tags);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@ _iq_disco_info_request(gchar *jid)
|
||||
|
||||
xmpp_id_handler_add(conn, _disco_info_response_handler, id, NULL);
|
||||
|
||||
free(id);
|
||||
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
@@ -172,6 +174,8 @@ _iq_room_info_request(gchar *room)
|
||||
|
||||
xmpp_id_handler_add(conn, _disco_info_response_handler, id, room);
|
||||
|
||||
free(id);
|
||||
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
|
||||
log_info("Error joining room: %s, reason: %s", fulljid->barejid, error_cond);
|
||||
handle_room_join_error(fulljid->barejid, error_cond);
|
||||
jid_destroy(fulljid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -753,7 +754,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
||||
handle_leave_room(room);
|
||||
}
|
||||
|
||||
g_slist_free(status_codes);
|
||||
g_slist_free_full(status_codes, free);
|
||||
}
|
||||
|
||||
// self online
|
||||
@@ -797,6 +798,8 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
||||
} else {
|
||||
handle_room_occupant_offline(room, nick, "offline", status_str);
|
||||
}
|
||||
|
||||
g_slist_free_full(status_codes, free);
|
||||
}
|
||||
|
||||
// room occupant online
|
||||
|
||||
@@ -113,6 +113,7 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid,
|
||||
xmpp_stanza_set_name(stanza, STANZA_NAME_IQ);
|
||||
char *id = create_unique_id("bookmark_add");
|
||||
xmpp_stanza_set_id(stanza, id);
|
||||
free(id);
|
||||
xmpp_stanza_set_type(stanza, STANZA_TYPE_SET);
|
||||
|
||||
xmpp_stanza_t *pubsub = xmpp_stanza_new(ctx);
|
||||
@@ -1054,6 +1055,7 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
|
||||
if (muc_active(from_jid->barejid)) {
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
if (g_strcmp0(from_jid->resourcepart, nick) == 0) {
|
||||
jid_destroy(from_jid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1065,6 +1067,7 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
char *old_nick = muc_old_nick(from_jid->barejid, new_nick);
|
||||
if (g_strcmp0(old_nick, nick) == 0) {
|
||||
jid_destroy(from_jid);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1090,7 +1093,7 @@ stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns)
|
||||
if (g_strcmp0(name, STANZA_NAME_STATUS) == 0) {
|
||||
char *code = xmpp_stanza_get_attribute(child, STANZA_ATTR_CODE);
|
||||
if (code) {
|
||||
codes = g_slist_append(codes, code);
|
||||
codes = g_slist_append(codes, strdup(code));
|
||||
}
|
||||
}
|
||||
child = xmpp_stanza_get_next(child);
|
||||
|
||||
Reference in New Issue
Block a user