summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-08-28 15:25:30 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-08-28 15:25:30 +0200
commitf843f904bc9fc1c8d0d2dfddd5e15aaa9738ec0d (patch)
tree82944d494970ee9095e0dfd59cb2edaf067cb379 /src/plugins/relay
parente411d14b7a239b47a87f22c20ce193e37481f672 (diff)
downloadweechat-f843f904bc9fc1c8d0d2dfddd5e15aaa9738ec0d.zip
core: fix bugs with calls to realloc
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/relay-client-irc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/relay/relay-client-irc.c b/src/plugins/relay/relay-client-irc.c
index 2c7eda9b1..a48e298be 100644
--- a/src/plugins/relay/relay-client-irc.c
+++ b/src/plugins/relay/relay-client-irc.c
@@ -469,7 +469,7 @@ void
relay_client_irc_send_join (struct t_relay_client *client,
const char *channel)
{
- char *infolist_name, *nicks;
+ char *infolist_name, *nicks, *nicks2;
const char *nick, *prefix, *topic;
char *host;
int length, length_nicks;
@@ -540,7 +540,14 @@ relay_client_irc_send_join (struct t_relay_client *client,
length_nicks += strlen (nick) + 1 + 1;
if (nicks)
{
- nicks = realloc (nicks, length_nicks);
+ nicks2 = realloc (nicks, length_nicks);
+ if (!nicks2)
+ {
+ if (nicks)
+ free (nicks);
+ return;
+ }
+ nicks = nicks2;
strcat (nicks, " ");
}
else