From 4c13200888f006889e0ca8e46a68d09a2dff26e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Thu, 18 Sep 2014 19:55:16 +0200 Subject: [PATCH] Fixed bug where friend request message was freed too soon. --- src/tox-weechat-tox-callbacks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tox-weechat-tox-callbacks.c b/src/tox-weechat-tox-callbacks.c index 1c40b91..09e4bec 100644 --- a/src/tox-weechat-tox-callbacks.c +++ b/src/tox-weechat-tox-callbacks.c @@ -195,7 +195,6 @@ tox_weechat_callback_friend_request(Tox *tox, char *message_nt = tox_weechat_null_terminate(message, length); int rc = tox_weechat_friend_request_add(identity, public_key, message_nt); - free(message_nt); if (rc == 0) { @@ -207,12 +206,13 @@ tox_weechat_callback_friend_request(Tox *tox, hex_address, message_nt); } - if (rc == -1) + else if (rc == -1) { weechat_printf(identity->buffer, "%sReceived a friend request, but your friend request list is full!", weechat_prefix("warning")); } + free(message_nt); }