# HG changeset patch # User Tero Marttila # Date 1240496276 -10800 # Node ID 2d8dec363f9e9cb5cdfd27598db1d8868ed8da28 # Parent fd97eb3c183acb6581ec451df8ea5e1c6aeed21c fix irc_chan to copy the irc_chan_info strings diff -r fd97eb3c183a -r 2d8dec363f9e src/irc_chan.c --- a/src/irc_chan.c Thu Apr 23 17:17:33 2009 +0300 +++ b/src/irc_chan.c Thu Apr 23 17:17:56 2009 +0300 @@ -289,7 +289,10 @@ // store chan->net = net; - chan->info = *info; + + // copy info + if ((chan->info.channel = strdup(info->channel)) == NULL) + JUMP_SET_ERROR(err, ERR_STRDUP); // init LIST_INIT(&chan->users); @@ -321,13 +324,10 @@ irc_chan_remove_user(chan, chan_user); } - // free command handlers + // free chan itself irc_cmd_free(&chan->handlers); - - // free callbacks chain_free(&chan->callbacks); - - // free chan itself + free((char *) chan->info.channel); free(chan); } diff -r fd97eb3c183a -r 2d8dec363f9e src/irc_chan.h --- a/src/irc_chan.h Thu Apr 23 17:17:33 2009 +0300 +++ b/src/irc_chan.h Thu Apr 23 17:17:56 2009 +0300 @@ -132,6 +132,8 @@ * * The channel will be in the IRC_CHAN_INIT state after this. * + * The contents of \a info will be copied. + * * @param chan_ptr the new irc_chan is returned via this pointer * @param net the irc_net this channel is on * @param info the channel's identifying information