relay: fix crash on /upgrade when the real IP is not set (closes #1294)

v2.8-utf8proc
Sébastien Helleu 2019-01-28 20:37:38 +01:00
parent 50415dfbb7
commit c869aa3809
2 changed files with 3 additions and 1 deletions

View File

@ -41,6 +41,7 @@ Bug fixes::
* irc: return IRC color code instead of WeeChat color code when decoding a too short ANSI color sequence
* irc: fix encoding of italic attribute when colors are removed
* irc: fix parsing of "time" message tag on FreeBSD (issue #1289)
* relay: fix crash on /upgrade when the real IP is not set (issue #1294)
* relay: fix memory leak in connection of client
Tests::

View File

@ -1414,7 +1414,8 @@ relay_client_new_with_infolist (struct t_infolist *infolist)
new_client->websocket = weechat_infolist_integer (infolist, "websocket");
new_client->http_headers = NULL;
new_client->address = strdup (weechat_infolist_string (infolist, "address"));
new_client->real_ip = strdup (weechat_infolist_string (infolist, "real_ip"));
str = weechat_infolist_string (infolist, "real_ip");
new_client->real_ip = (str) ? strdup (str) : NULL;
new_client->status = weechat_infolist_integer (infolist, "status");
new_client->protocol = weechat_infolist_integer (infolist, "protocol");
str = weechat_infolist_string (infolist, "protocol_string");