fix a couple memleaks and change to Unreal infoline processing

This commit is contained in:
Mark 2004-01-25 21:05:36 +00:00
parent 3b7ee0cdae
commit af540400cf
7 changed files with 31 additions and 24 deletions

View file

@ -435,22 +435,21 @@ m_credits (char *origin, char **argv, int argc, int srv)
/* m_server
* argv[0] = servername
* argv[2] = hopcount
* argv[3] = numeric
* argv[4] = serverinfo
* on old protocols, serverinfo is argv[3], and numeric is left out
* argv[1] = hopcount
* argv[2] = numeric
* argv[3] = serverinfo
* on old protocols, serverinfo is argv[2], and numeric is left out
*/
/*SERVER servername hopcount :U<protocol>-flags-numeric serverdesc*/
static void
m_server (char *origin, char **argv, int argc, int srv)
{
char* s = NULL;
/* server desc is in argv[2] but so is some other stuff
/* server desc is in argv[3] but so is some other stuff
* so we need to strip protocol, flags and numeric.
*/
if(argc > 2) {
s = argv[2];
s = argv[3];
while(*s != ' ')
s++;
s++;

View file

@ -5,6 +5,7 @@ Shmad & ^Enigma^
- New SERVWATCH option to track server joins/quits (M)
- Tidy up message strings (M)
- Add user@host to server kills (M)
- Fix mem leak from strdup (M)
* Version 1.12 * Fish (F) * December 28, 2003
- Gecos is echoed in signon/signoff now (F)

View file

@ -512,6 +512,7 @@ static int cs_user_kill(char **av, int ac)
u->nick, u->username, u->hostname,
Kill[0], GlobalMsg);
}
free(cmd);
free(GlobalMsg);
return 1;
}

View file

@ -5,15 +5,16 @@ Shmad & ^Enigma & Fish^
(F) denotes Fish (M) denotes Mark
* Revision 1199 * January 9, 2004 (M)
- removed fopen attempt on old system of dl/statserv/html/index.tpl.
- improved error message for failed open of template and output file
- begin reworking announcement code for wallops
- removed fopen attempt on old system of dl/statserv/html/index.tpl. (M)
- improved error message for failed open of template and output file (M)
- begin reworking announcement code for wallops (M)
- move SERVER join/quit anouncements to ConnectServ since it is not really a
StatServ task
StatServ task (M)
- New set options LAGALERT and RECORDALERT which allow a user to determine
how these alerts are managed 0 none, 1 channel, 2 globops, 3 wallops
how these alerts are managed 0 none, 1 channel, 2 globops, 3 wallops (M)
- Removed MSGTHROTTLE and LAG options. These are superceded by new options
MSGINTERVAL, MSGLIMIT, LAGTIME
MSGINTERVAL, MSGLIMIT, LAGTIME (M)
- Fix mem leak from strdup (M)
* Revision 810 * Nov 23rd, 2003 (M)
- change SSMNAME to __module_info.module_name to be consistent with other modules (M)

View file

@ -337,7 +337,7 @@ int s_user_kill(char **av, int ac)
{
SStats *s;
SStats *ss;
char *cmd, *who;
char *rbuf, *cmd, *who;
User *u;
SET_SEGV_LOCATION();
@ -351,7 +351,8 @@ int s_user_kill(char **av, int ac)
}
DecreaseUsers(s);
DelTLD(u);
cmd = sstrdup(recbuf);
rbuf = sstrdup(recbuf);
cmd = rbuf;
who = strtok(cmd, " ");
cmd = strtok(NULL, " ");
cmd = strtok(NULL, " ");
@ -366,6 +367,7 @@ int s_user_kill(char **av, int ac)
ss = findstats(who);
ss->serverkills = ss->serverkills + 1;
}
free(rbuf);
return 1;
}

6
misc.c
View file

@ -50,16 +50,14 @@ strip (char *line)
*c = '\0';
}
/** @brief Our Own implementation of Malloc.
/** @brief NeoStats implementation of malloc.
*
* Allocates memory for internal variables. Usefull for Memory Debugging
* Allocates memory for internal variables. Useful for memory debugging
* if enough memory can't be malloced, exit the program
*
* @param size The amount of memory to Malloc
*
* @returns size bytes of memory or NULL on malloc error
*
* @todo move this to a util type file, as it being in main is crazy
*/
void *

15
users.c
View file

@ -41,8 +41,7 @@ hash_t *uh;
static void doDelUser (const char *nick, int killflag, const char *quitreason);
static User *new_user (const char *nick);
char quitreason[BUFSIZE];
static char quitreason[BUFSIZE];
static User *
new_user (const char *nick)
@ -53,13 +52,16 @@ new_user (const char *nick)
SET_SEGV_LOCATION();
u = smalloc (sizeof (User));
bzero(u, sizeof(User));
if (!nick)
strsetnull (u->nick);
else
if (!nick) {
nlog (LOG_CRITICAL, LOG_CORE, "new_user: trying to add user with NULL nickname");
return NULL;
} else {
strlcpy (u->nick, nick, MAXNICK);
}
un = hnode_create (u);
if (hash_isfull (uh)) {
nlog (LOG_CRITICAL, LOG_CORE, "new_user: user hash is full");
return NULL;
} else {
hash_insert (uh, un, u->nick);
}
@ -96,6 +98,9 @@ AddUser (const char *nick, const char *user, const char *host, const char *realn
nlog (LOG_DEBUG2, LOG_CORE, "AddUser: %s (%s@%s) %s (%d) -> %s at %lu", nick, user, host, realname, (int)htonl (ipaddress), server, (unsigned long)time);
u = new_user (nick);
if (!u) {
return;
}
strlcpy (u->hostname, host, MAXHOST);
strlcpy (u->vhost, host, MAXHOST);
strlcpy (u->username, user, MAXUSER);