1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Merge pull request #1157 from profanity-im/fix/1156-segfault-block-command

Fix segfault in block command
This commit is contained in:
Michael Vetter 2019-07-19 13:17:22 +02:00 committed by GitHub
commit 9357726ed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,18 +235,15 @@ _block_add_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
const char *type = xmpp_stanza_get_type(stanza);
if (!type) {
log_info("Block response received for %s with no type attribute.", jid);
free(jid);
return 0;
}
if (g_strcmp0(type, "result") != 0) {
log_info("Block response received for %s with unrecognised type attribute.", jid);
free(jid);
return 0;
}
cons_show("User %s successfully blocked.", jid);
free(jid);
return 0;
}
@ -259,18 +256,15 @@ _block_remove_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
const char *type = xmpp_stanza_get_type(stanza);
if (!type) {
log_info("Unblock response received for %s with no type attribute.", jid);
free(jid);
return 0;
}
if (g_strcmp0(type, "result") != 0) {
log_info("Unblock response received for %s with unrecognised type attribute.", jid);
free(jid);
return 0;
}
cons_show("User %s successfully unblocked.", jid);
free(jid);
return 0;
}