mirror of
https://github.com/anope/anope.git
synced 2026-07-04 00:43:12 +02:00
Memory: Properly initialize and free new module languages.
Memory: Properly free strings in module config directive lookups. Memory: Do not leak module version and author in rare situations. Memory: Memory leak when deleting a module callback. Memory: Memory leaks with module messages. Memory: Memory leaks with module commands. Memory: Memory leaks with module event handlers. Memory: Memory leaks with module event hooks. Memory: Every module config entry of type string is leaked on config reload. Memory: Leak services root list, ulines list, host setters list, modules autoload list, modules delayed autoload list, hostserv/memoserv/helpserv/botserv/operserv/chanserv/nickserv core modules lists on config reload. Memory: Leaks with channel bans/invites/exceptions. Memory: Leak when updating already existing ignore. Memory: Invalid pointer read in slists. Memory: Leak when using /cs appendtopic. Memory: Leak on (currently impossible) config reload. Memory: Syscall param write(buf) points to uninitialised byte(s) in save_ns_dbase(). Memory: Leak if PreNickServDB is set and NSEmailReg is not. Removing a command no longer calls free() on help_param*, reversed previous changes Changes to CSMaxReg, MSMaxMemos and NewsCount are now properly reflected in help notices after config reload Small adjustments Fixed copy&paste mistake Fix findCommand() searching in the wrong command tables
This commit is contained in:
@@ -37,6 +37,7 @@ static int do_set_opnotice(User * u, ChannelInfo * ci, char *param);
|
||||
static int do_set_xop(User * u, ChannelInfo * ci, char *param);
|
||||
static int do_set_peace(User * u, ChannelInfo * ci, char *param);
|
||||
static int do_set_noexpire(User * u, ChannelInfo * ci, char *param);
|
||||
static int reload_config(int argc, char **argv);
|
||||
static void myChanServHelp(User * u);
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,7 @@ static void myChanServHelp(User * u);
|
||||
int AnopeInit(int argc, char **argv)
|
||||
{
|
||||
Command *c;
|
||||
EvtHook *hook;
|
||||
|
||||
moduleAddAuthor("Anope");
|
||||
moduleAddVersion(VERSION_STRING);
|
||||
@@ -125,6 +127,12 @@ int AnopeInit(int argc, char **argv)
|
||||
|
||||
moduleSetChanHelp(myChanServHelp);
|
||||
|
||||
hook = createEventHook(EVENT_RELOAD, reload_config);
|
||||
if (moduleAddEventHook(hook) != MOD_ERR_OK) {
|
||||
alog("[\002cs_set\002] Can't hook to EVENT_RELOAD event");
|
||||
return MOD_STOP;
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -898,3 +906,18 @@ static int do_set_noexpire(User * u, ChannelInfo * ci, char *param)
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Upon /os reload refresh the limit in help output
|
||||
**/
|
||||
static int reload_config(int argc, char **argv) {
|
||||
Command *c;
|
||||
|
||||
if (argc >= 1 && !stricmp(argv[0], EVENT_START))
|
||||
if ((c = findCommand(CHANSERV, "SET SUCCESSOR")))
|
||||
c->help_param1 = (char *) (long) CSMaxReg;
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
static int do_set(User * u);
|
||||
static int do_set_notify(User * u, MemoInfo * mi, char *param);
|
||||
static int do_set_limit(User * u, MemoInfo * mi, char *param);
|
||||
static int reload_config(int argc, char **argv);
|
||||
static void myMemoServHelp(User * u);
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,7 @@ static void myMemoServHelp(User * u);
|
||||
int AnopeInit(int argc, char **argv)
|
||||
{
|
||||
Command *c;
|
||||
EvtHook *hook;
|
||||
|
||||
moduleAddAuthor("Anope");
|
||||
moduleAddVersion(VERSION_STRING);
|
||||
@@ -49,6 +51,12 @@ int AnopeInit(int argc, char **argv)
|
||||
|
||||
moduleSetMemoHelp(myMemoServHelp);
|
||||
|
||||
hook = createEventHook(EVENT_RELOAD, reload_config);
|
||||
if (moduleAddEventHook(hook) != MOD_ERR_OK) {
|
||||
alog("[\002ms_set\002] Can't hook to EVENT_RELOAD event");
|
||||
return MOD_STOP;
|
||||
}
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -293,3 +301,16 @@ static int do_set_limit(User * u, MemoInfo * mi, char *param)
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upon /os reload refresh the limit in help output
|
||||
**/
|
||||
static int reload_config(int argc, char **argv) {
|
||||
Command *c;
|
||||
|
||||
if (argc >= 1 && !stricmp(argv[0], EVENT_START))
|
||||
if ((c = findCommand(MEMOSERV, "SET LIMIT")))
|
||||
c->help_param1 = (char *) (long) MSMaxMemos;
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+4
-19
@@ -27,7 +27,6 @@ int AnopeInit(int argc, char **argv)
|
||||
{
|
||||
Command *c;
|
||||
EvtHook *hook;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
moduleAddAuthor("Anope");
|
||||
moduleAddVersion(VERSION_STRING);
|
||||
@@ -39,8 +38,7 @@ int AnopeInit(int argc, char **argv)
|
||||
**/
|
||||
c = createCommand("LOGONNEWS", do_logonnews, is_services_admin,
|
||||
NEWS_HELP_LOGON, -1, -1, -1, -1);
|
||||
snprintf(buf, BUFSIZE, "%d", NewsCount),
|
||||
c->help_param1 = sstrdup(buf);
|
||||
c->help_param1 = (char *) (long) NewsCount;
|
||||
moduleAddCommand(OPERSERV, c, MOD_UNIQUE);
|
||||
|
||||
moduleSetOperHelp(myOperServHelp);
|
||||
@@ -59,12 +57,6 @@ int AnopeInit(int argc, char **argv)
|
||||
**/
|
||||
void AnopeFini(void)
|
||||
{
|
||||
Command *c = findCommand(OPERSERV, "LOGONNEWS");
|
||||
if (c && c->help_param1)
|
||||
{
|
||||
free(c->help_param1);
|
||||
c->help_param1 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,18 +76,11 @@ static void myOperServHelp(User * u)
|
||||
* Upon /os reload refresh the count
|
||||
**/
|
||||
static int reload_config(int argc, char **argv) {
|
||||
char buf[BUFSIZE];
|
||||
Command *c;
|
||||
|
||||
if (argc >= 1) {
|
||||
if (!stricmp(argv[0], EVENT_START)) {
|
||||
if ((c = findCommand(OPERSERV, "LOGONNEWS"))) {
|
||||
free(c->help_param1);
|
||||
snprintf(buf, BUFSIZE, "%d", NewsCount),
|
||||
c->help_param1 = sstrdup(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc >= 1 && !stricmp(argv[0], EVENT_START))
|
||||
if ((c = findCommand(OPERSERV, "LOGONNEWS")))
|
||||
c->help_param1 = (char *) (long) NewsCount;
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
+4
-20
@@ -27,7 +27,6 @@ int AnopeInit(int argc, char **argv)
|
||||
{
|
||||
Command *c;
|
||||
EvtHook *hook;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
moduleAddAuthor("Anope");
|
||||
moduleAddVersion(VERSION_STRING);
|
||||
@@ -39,8 +38,7 @@ int AnopeInit(int argc, char **argv)
|
||||
**/
|
||||
c = createCommand("OPERNEWS", do_opernews, is_services_admin,
|
||||
NEWS_HELP_OPER, -1, -1, -1, -1);
|
||||
snprintf(buf, BUFSIZE, "%d", NewsCount),
|
||||
c->help_param1 = sstrdup(buf);
|
||||
c->help_param1 = (char *) (long) NewsCount;
|
||||
moduleAddCommand(OPERSERV, c, MOD_UNIQUE);
|
||||
|
||||
moduleSetOperHelp(myOperServHelp);
|
||||
@@ -59,13 +57,6 @@ int AnopeInit(int argc, char **argv)
|
||||
**/
|
||||
void AnopeFini(void)
|
||||
{
|
||||
Command *c = findCommand(OPERSERV, "OPERNEWS");
|
||||
|
||||
if (c && c->help_param1)
|
||||
{
|
||||
free(c->help_param1);
|
||||
c->help_param1 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,18 +75,11 @@ static void myOperServHelp(User * u)
|
||||
* Upon /os reload refresh the count
|
||||
**/
|
||||
static int reload_config(int argc, char **argv) {
|
||||
char buf[BUFSIZE];
|
||||
Command *c;
|
||||
|
||||
if (argc >= 1) {
|
||||
if (!stricmp(argv[0], EVENT_START)) {
|
||||
if ((c = findCommand(OPERSERV, "OPERNEWS"))) {
|
||||
free(c->help_param1);
|
||||
snprintf(buf, BUFSIZE, "%d", NewsCount),
|
||||
c->help_param1 = sstrdup(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc >= 1 && !stricmp(argv[0], EVENT_START))
|
||||
if ((c = findCommand(OPERSERV, "OPERNEWS")))
|
||||
c->help_param1 = (char *) (long) NewsCount;
|
||||
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user