mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Fixed possible NULL pointer references when offline
This commit is contained in:
parent
8322c48d3e
commit
e49bea4d6b
@ -765,17 +765,23 @@ _cmd_tiny(const char * const inp, struct cmd_help_t help)
|
||||
free(url);
|
||||
} else if (win_in_chat()) {
|
||||
char *tiny = tinyurl_get(url);
|
||||
char *recipient = win_get_recipient();
|
||||
jabber_send(tiny, recipient);
|
||||
|
||||
if (tiny != NULL) {
|
||||
char *recipient = win_get_recipient();
|
||||
jabber_send(tiny, recipient);
|
||||
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = jabber_get_jid();
|
||||
chat_log_chat(jid, recipient, tiny, OUT);
|
||||
if (prefs_get_chlog()) {
|
||||
const char *jid = jabber_get_jid();
|
||||
chat_log_chat(jid, recipient, tiny, OUT);
|
||||
}
|
||||
|
||||
win_show_outgoing_msg("me", recipient, tiny);
|
||||
free(recipient);
|
||||
free(tiny);
|
||||
} else {
|
||||
cons_bad_show("Couldn't get tinyurl.");
|
||||
}
|
||||
|
||||
win_show_outgoing_msg("me", recipient, tiny);
|
||||
free(recipient);
|
||||
free(tiny);
|
||||
|
||||
free(url);
|
||||
} else {
|
||||
cons_bad_command(inp);
|
||||
|
@ -53,9 +53,12 @@ release_get_latest()
|
||||
curl_easy_perform(handle);
|
||||
curl_easy_cleanup(handle);
|
||||
|
||||
output.buffer[output.size++] = '\0';
|
||||
|
||||
return output.buffer;
|
||||
if (output.buffer != NULL) {
|
||||
output.buffer[output.size++] = '\0';
|
||||
return output.buffer;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t
|
||||
|
@ -60,10 +60,14 @@ tinyurl_get(char *url)
|
||||
curl_easy_perform(handle);
|
||||
curl_easy_cleanup(handle);
|
||||
|
||||
output.buffer[output.size++] = '\0';
|
||||
g_string_free(full_url, TRUE);
|
||||
|
||||
return output.buffer;
|
||||
if (output.buffer != NULL) {
|
||||
output.buffer[output.size++] = '\0';
|
||||
return output.buffer;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t
|
||||
|
Loading…
Reference in New Issue
Block a user