Fixed bug where friend request message was freed too soon.

This commit is contained in:
Håvard Pettersson 2014-09-18 19:55:16 +02:00
parent 1bd4d6b02b
commit 4c13200888

View file

@ -195,7 +195,6 @@ tox_weechat_callback_friend_request(Tox *tox,
char *message_nt = tox_weechat_null_terminate(message, length); char *message_nt = tox_weechat_null_terminate(message, length);
int rc = tox_weechat_friend_request_add(identity, public_key, message_nt); int rc = tox_weechat_friend_request_add(identity, public_key, message_nt);
free(message_nt);
if (rc == 0) if (rc == 0)
{ {
@ -207,12 +206,13 @@ tox_weechat_callback_friend_request(Tox *tox,
hex_address, hex_address,
message_nt); message_nt);
} }
if (rc == -1) else if (rc == -1)
{ {
weechat_printf(identity->buffer, weechat_printf(identity->buffer,
"%sReceived a friend request, but your friend request list is full!", "%sReceived a friend request, but your friend request list is full!",
weechat_prefix("warning")); weechat_prefix("warning"));
} }
free(message_nt);
} }