some more mem leak cleanups

This commit is contained in:
Fish 2003-11-07 13:02:02 +00:00
parent 2c403b610f
commit 60c14c1f0d
5 changed files with 7 additions and 6 deletions

View file

@ -25,6 +25,7 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rant
- replaced all calls to time(NULL) with me.now, which is updated a couple of times each loop. Should reduce the number of system calls a bit.
- StatServ has had big performance improvements with regards to the database. Now progressively saves channel data, and only loads channel data when required. Should stop some of those mysterious 8 hour pingouts on large networks and reduce memory overhead !
- dont do assertion checking by default anymore. We are pretty stable. pass --enable-debug to configure to enable if you have weird crashes now
- Some Memory Leak cleanups
* NeoStats * Fish (F) & Mark (M)* Version 2.5.7
- Update parse() and splitbuf to suport IRCu (F)

7
dl.c
View file

@ -455,6 +455,7 @@ del_bot_from_chan (char *bot, char *chan)
hnode_t *cbn;
Chan_Bot *bc;
lnode_t *bmn;
char *botname;
cbn = hash_lookup (bch, chan);
if (!cbn) {
@ -468,12 +469,13 @@ del_bot_from_chan (char *bot, char *chan)
return;
}
list_delete (bc->bots, bmn);
free (lnode_get (bmn));
botname = lnode_get(bmn);
free (botname);
lnode_destroy (bmn);
if (list_isempty (bc->bots)) {
/* delete the hash and list because its all over */
hash_delete (bch, cbn);
list_destroy (bc->bots);
lnode_destroy (bmn);
free (bc->chan);
hnode_destroy (cbn);
}
@ -560,7 +562,6 @@ new_bot (char *bot_name)
strsetnull (u->nick);
else
strlcpy (u->nick, bot_name, MAXNICK);
u->chanlist = hash_create (C_TABLE_SIZE, 0, 0);
bn = hnode_create (u);
if (hash_isfull (bh)) {
chanalert (s_Services, "Warning ModuleBotlist is full");

2
dl.h
View file

@ -144,8 +144,6 @@ typedef struct {
message_function function;
/** function */
chan_message_function chanfunc;
/** channel list */
hash_t *chanlist;
}Mod_User;
hash_t *bh;

View file

@ -258,6 +258,7 @@ CStats *load_chan(char *name) {
/* its the new database format... Good */
sscanf(data, "%ld %ld %ld %ld %ld %ld %ld %ld %ld", &c->topics, &c->totmem, &c->kicks, &c->maxmems, &c->t_maxmems, &c->maxkicks, &c->t_maxkicks, &c->maxjoins, &c->t_maxjoins);
GetData((void *)&c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen");
free(data);
} else if (GetData((void *)&c->topics, CFGINT, "ChanStats", c->name, "Topics") > 0) {
GetData((void *)&c->totmem, CFGINT, "ChanStats", c->name, "TotalMems");
GetData((void *)&c->kicks, CFGINT, "ChanStats", c->name, "Kicks");
@ -281,7 +282,6 @@ CStats *load_chan(char *name) {
c->maxjoins = 0;
c->t_maxjoins = c->t_maxmems;
}
free(data);
c->topicstoday = 0;
c->joinstoday = 0;
c->members = 0;

1
ircd.c
View file

@ -109,6 +109,7 @@ del_bot (char *nick, char *reason)
nlog (LOG_WARNING, LOG_CORE, "Attempting to Logoff with a Nickname that does not Exists: %s", nick);
return NS_FAILURE;
}
//XXXX TODO: need to free the channel list hash. We dont according to valgrind
squit_cmd (nick, reason);
del_mod_user (nick);
return NS_SUCCESS;