Mercurial > pidgin.yaz
changeset 1021:90e8714bf95b
[gaim-migrate @ 1031]
Fixed a few little memory leaks.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Tue, 24 Oct 2000 01:10:30 +0000 |
parents | e1e36f95af9a |
children | d5c022006a60 |
files | plugins/irc.c |
diffstat | 1 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/irc.c Mon Oct 23 21:01:25 2000 +0000 +++ b/plugins/irc.c Tue Oct 24 01:10:30 2000 +0000 @@ -47,7 +47,7 @@ #include "pixmaps/ok.xpm" /* FIXME: We shouldn't have hard coded servers and ports :-) */ -#define IRC_SERVER "irc.undernet.org" +#define IRC_SERVER "irc.mozilla.org" #define IRC_PORT 6667 #define IRC_BUF_LEN 4096 @@ -192,7 +192,7 @@ void irc_chat_send( struct gaim_connection *gc, int id, char *message) { struct irc_data *idata = (struct irc_data *)gc->proto_data; - struct irc_channel *channel = g_new0(struct irc_channel, 1); + struct irc_channel *channel = NULL; gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN + 1); /* First lets get our current channel */ @@ -201,6 +201,7 @@ if (!channel) { /* If for some reason we've lost our channel, let's bolt */ + g_free(buf); return; } @@ -365,6 +366,9 @@ add_chat_buddy(convo, buf2[i]); } } + + /* And free our pointers */ + g_strfreev (buf2); return; @@ -432,7 +436,7 @@ gchar u_channel[128]; gchar u_nick[128]; - struct irc_channel *channel = g_new0(struct irc_channel, 1); + struct irc_channel *channel; int id; int j; GList *test = NULL; @@ -472,7 +476,6 @@ serv_got_chat_left(gc, channel->id); idata->channels = g_list_remove(idata->channels, channel); - g_free(channel); } else { struct conversation *convo = NULL; @@ -614,12 +617,26 @@ void irc_close(struct gaim_connection *gc) { struct irc_data *idata = (struct irc_data *)gc->proto_data; + GList *chats = idata->channels; + struct irc_channel *cc; + gchar *buf = (gchar *)g_malloc(IRC_BUF_LEN); - g_snprintf(buf, IRC_BUF_LEN, "QUIT :GAIM [www.marko.net/gaim]\n"); + g_snprintf(buf, IRC_BUF_LEN, "QUIT :Download GAIM [www.marko.net/gaim]\n"); write(idata->fd, buf, strlen(buf)); g_free(buf); + + while (chats) { + cc = (struct irc_channel *)chats->data; + g_free(cc->name); + chats = g_list_remove(chats, cc); + g_free(cc); + } + + if (gc->inpa) + gdk_input_remove(gc->inpa); + close(idata->fd); g_free(gc->proto_data); }