1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fixed various jid and account mem leaks

This commit is contained in:
James Booth 2015-06-24 20:53:04 +01:00
parent 626ab51ed4
commit 240f6a3f79
6 changed files with 10 additions and 1 deletions

View File

@ -226,6 +226,7 @@ cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
} else { } else {
cons_show("Error evaluating password, see logs for details."); cons_show("Error evaluating password, see logs for details.");
g_free(lower); g_free(lower);
account_free(account);
return TRUE; return TRUE;
} }
@ -2179,6 +2180,7 @@ cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
if (!parsed) { if (!parsed) {
cons_show("Usage: %s", help.usage); cons_show("Usage: %s", help.usage);
cons_show(""); cons_show("");
jid_destroy(room_arg);
return TRUE; return TRUE;
} }

View File

@ -411,6 +411,8 @@ accounts_set_jid(const char * const account_name, const char * const value)
_save_accounts(); _save_accounts();
} }
jid_destroy(jid);
} }
} }

View File

@ -366,6 +366,7 @@ _jabber_connect(const char * const fulljid, const char * const passwd,
} else if (jid->fulljid == NULL) { } else if (jid->fulljid == NULL) {
log_error("Full JID required to connect, received: %s", fulljid); log_error("Full JID required to connect, received: %s", fulljid);
jabber_conn.conn_status = JABBER_DISCONNECTED; jabber_conn.conn_status = JABBER_DISCONNECTED;
jid_destroy(jid);
return jabber_conn.conn_status; return jabber_conn.conn_status;
} }

View File

@ -170,6 +170,7 @@ message_send_chat_pgp(const char * const barejid, const char * const msg)
} else { } else {
message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg); message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg);
} }
jid_destroy(jidp);
} else { } else {
message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg); message = stanza_create_message(ctx, id, jid, STANZA_TYPE_CHAT, msg);
} }
@ -449,6 +450,7 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
// XEP-0249 // XEP-0249
char *room = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_JID); char *room = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_JID);
if (!room) { if (!room) {
jid_destroy(jidp);
return 1; return 1;
} }
@ -754,6 +756,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
// private message from chat room use full jid (room/nick) // private message from chat room use full jid (room/nick)
if (muc_active(jid->barejid)) { if (muc_active(jid->barejid)) {
_private_chat_handler(stanza, jid->fulljid); _private_chat_handler(stanza, jid->fulljid);
jid_destroy(jid);
return 1; return 1;
} }

View File

@ -670,6 +670,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
// invalid from attribute // invalid from attribute
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);
if (from_jid == NULL || from_jid->resourcepart == NULL) { if (from_jid == NULL || from_jid->resourcepart == NULL) {
jid_destroy(from_jid);
return 1; return 1;
} }