1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

registration: memory leaks, error checking

This commit is contained in:
swirl 2021-10-13 15:02:05 -04:00
parent feaa770444
commit 0653200965
2 changed files with 6 additions and 6 deletions

View File

@ -509,7 +509,7 @@ connection_register(const char* const altdomain, int port, const char* const tls
log_warning("Failed to get libstrophe conn during connect");
return JABBER_DISCONNECTED;
}
xmpp_conn_set_jid(conn.xmpp_conn, strdup(altdomain));
xmpp_conn_set_jid(conn.xmpp_conn, altdomain);
flags = xmpp_conn_get_flags(conn.xmpp_conn);
@ -542,9 +542,10 @@ connection_register(const char* const altdomain, int port, const char* const tls
prof_reg_t *reg;
reg = malloc(sizeof(*reg));
if (reg != NULL) {
memset(reg, 0, sizeof(*reg));
reg = calloc(1, sizeof(*reg));
if (reg == NULL) {
log_warning("Failed to allocate registration data struct during connect");
return JABBER_DISCONNECTED;
}
reg->username = strdup(username);

View File

@ -2755,8 +2755,7 @@ xmpp_stanza_t*
stanza_register_new_account(xmpp_ctx_t* ctx, const char* const user, const char* const password)
{
char* id = connection_create_stanza_id();
//char* id = "reg2";
xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, strdup(id));
xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id);
xmpp_stanza_t* register_new_account = xmpp_stanza_new(ctx);