1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

In expando_hostname, set *free_ret to TRUE

*free_ret must be set to TRUE in both cases, since we return
some newly initialised memory
This commit is contained in:
kyak 2015-08-29 15:29:57 +03:00
parent 0435331912
commit 19760679eb

View File

@ -86,6 +86,8 @@ static char *expando_hostname(SERVER_REC *server, void *item, int *free_ret)
ircserver = IRC_SERVER(server); ircserver = IRC_SERVER(server);
*free_ret = TRUE;
/* prefer the _real_ /userhost reply */ /* prefer the _real_ /userhost reply */
if (ircserver != NULL && ircserver->userhost != NULL) { if (ircserver != NULL && ircserver->userhost != NULL) {
list = g_strsplit(ircserver->userhost, "@", -1); list = g_strsplit(ircserver->userhost, "@", -1);
@ -95,8 +97,6 @@ static char *expando_hostname(SERVER_REC *server, void *item, int *free_ret)
} }
/* haven't received userhost reply yet. guess something */ /* haven't received userhost reply yet. guess something */
*free_ret = TRUE;
if (gethostname(hostname, sizeof(hostname)) != 0 || *hostname == '\0') if (gethostname(hostname, sizeof(hostname)) != 0 || *hostname == '\0')
strcpy(hostname, "??"); strcpy(hostname, "??");
return g_strdup(hostname); return g_strdup(hostname);