summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormokkori <brezelzombie@live.de>2013-02-17 16:08:51 +0100
committerAdam <Adam@anope.org>2013-07-25 19:42:18 -0400
commitd2d89ac412dbdba0747e44cdf1e4c90e29f6ef2b (patch)
tree26a48c6e90a6eb02ba6326864c87879b810d00f2
parente090eaea65efdac33539d80317a9370c04681301 (diff)
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
-rw-r--r--lang/cat.l4
-rw-r--r--lang/de.l4
-rw-r--r--lang/en_us.l4
-rw-r--r--lang/es.l4
-rw-r--r--lang/fr.l4
-rw-r--r--lang/gr.l4
-rw-r--r--lang/hun.l4
-rw-r--r--lang/it.l4
-rw-r--r--lang/ja_utf8.l4
-rw-r--r--lang/nl.l4
-rw-r--r--lang/pl.l4
-rw-r--r--lang/pt.l4
-rw-r--r--lang/ru.l4
-rw-r--r--lang/tr.l4
-rw-r--r--src/channels.c15
-rw-r--r--src/config.c90
-rw-r--r--src/core/cs_set.c23
-rw-r--r--src/core/ms_set.c21
-rw-r--r--src/core/os_logonnews.c23
-rw-r--r--src/core/os_opernews.c24
-rw-r--r--src/events.c8
-rw-r--r--src/memoserv.c1
-rw-r--r--src/modules.c147
-rw-r--r--src/modules/cs_appendtopic.c2
-rw-r--r--src/modules/hs_request.c9
-rw-r--r--src/process.c1
-rw-r--r--src/slist.c4
27 files changed, 259 insertions, 165 deletions
diff --git a/lang/cat.l b/lang/cat.l
index dc94b0706..c3a18bdcf 100644
--- a/lang/cat.l
+++ b/lang/cat.l
@@ -3423,7 +3423,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3437,7 +3437,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/de.l b/lang/de.l
index 96ec46b02..261760106 100644
--- a/lang/de.l
+++ b/lang/de.l
@@ -3373,7 +3373,7 @@ NEWS_HELP_LOGON
Zeigt oder bearbeitet die Liste der LogonNews.
Nach der Verbindung des Users werden diese Nachrichten
- angezeigt. (Es werden jedoch nur max. %s angezeigt, um ein
+ angezeigt. (Es werden jedoch nur max. %d angezeigt, um ein
Flooding des Users zu verhindern. Wenn mehr News
existieren, werden nur die neuesten angezeigt.)
Die Anzahl der News können in der services.conf festgelegt werden.
@@ -3388,7 +3388,7 @@ NEWS_HELP_OPER
Zeigt oder bearbeitet die Liste der Oper-News.Nachdem
sich ein User die Oper-Flags gesetzt hat (mit dem
/OPER Befehl) werden ihm diese Nachrichten angezeigt.
- (Es werden jedoch nur max. %s Nachrichten angezeigt, um ein
+ (Es werden jedoch nur max. %d Nachrichten angezeigt, um ein
Flooding des Users zu verhindern. Wenn mehr News
existieren, werden nur die neüsten angezeigt.)
Die Anzahl der News können in der services.conf festgelegt werden.
diff --git a/lang/en_us.l b/lang/en_us.l
index 9cf6c6316..72db6eb3b 100644
--- a/lang/en_us.l
+++ b/lang/en_us.l
@@ -3283,7 +3283,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3297,7 +3297,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/es.l b/lang/es.l
index 86a00a0da..88a451350 100644
--- a/lang/es.l
+++ b/lang/es.l
@@ -3397,7 +3397,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3411,7 +3411,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/fr.l b/lang/fr.l
index 2d0eaeb07..a13b8587a 100644
--- a/lang/fr.l
+++ b/lang/fr.l
@@ -3483,7 +3483,7 @@ NEWS_HELP_LOGON
Édite ou affiche la liste de messages Logon News. Lorsqu'un
utilisateur se connecte au réseau, ces messages leur seront
- envoyés. (Cependant, pas plus de %s messages ne seront envoyés
+ envoyés. (Cependant, pas plus de %d messages ne seront envoyés
pour éviter le flood des utilisateurs. Si il y a plusieurs
messages de news, seuls les plus récents seront envoyés.) Le
nombre de news envoyées peut être configuré dans le
@@ -3498,7 +3498,7 @@ NEWS_HELP_OPER
Édite ou affiche la liste des messages Oper News. Quand un
utilisateur utilise la commande /OPER, ces messages lui seront
- envoyés. (Cependant, pas plus de %s messages ne seront envoyés
+ envoyés. (Cependant, pas plus de %d messages ne seront envoyés
afin de ne pas flooder l'utilisateur. Si il y a plusieurs
messages news, seuls les plus récents seront envoyés.) Le nombre
de news envoyées peut être configuré dans le services.conf.
diff --git a/lang/gr.l b/lang/gr.l
index ae504132a..48f5cbc3d 100644
--- a/lang/gr.l
+++ b/lang/gr.l
@@ -3415,7 +3415,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3429,7 +3429,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/hun.l b/lang/hun.l
index 590c5ab26..11fa09fca 100644
--- a/lang/hun.l
+++ b/lang/hun.l
@@ -3349,7 +3349,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3363,7 +3363,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/it.l b/lang/it.l
index b73695eea..1221035ab 100644
--- a/lang/it.l
+++ b/lang/it.l
@@ -3308,7 +3308,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3322,7 +3322,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/ja_utf8.l b/lang/ja_utf8.l
index 3f3d7944b..e18d7020c 100644
--- a/lang/ja_utf8.l
+++ b/lang/ja_utf8.l
@@ -3286,7 +3286,7 @@ NEWS_HELP_LOGON
ログオンニュースを編集���表示�る。ユーザ��ットワーク�
接続�������れら�メッセージ�ユーザ��信�れる
(����ユーザ��れを flood 攻撃�勘����������
- %s 個以上�メッセージ��信�れ��。��場��
+ %d 個以上�メッセージ��信�れ��。��場��
メッセージ�新��も��ら順��信�れる)。
NewsCount � services.conf 内�設定�る。
@@ -3300,7 +3300,7 @@ NEWS_HELP_OPER
サー�オペレータニュースを編集���表示�る。ユーザ�
サー�オペレータ��る (/OPER コマンド�) ���れら�メッセージ
�ユーザ��信�れる。(����ユーザ��れを flood 攻撃�勘��
- ��������%s 個以上�メッセージ��信�れ��。
+ ��������%d 個以上�メッセージ��信�れ��。
��場��メッセージ�新��も��ら順��信�れる)。
NewsCount � services.conf 内�設定�る。
diff --git a/lang/nl.l b/lang/nl.l
index c33f2b64e..a5f860c7e 100644
--- a/lang/nl.l
+++ b/lang/nl.l
@@ -3376,7 +3376,7 @@ NEWS_HELP_LOGON
Wijzigt de lijst met login nieuwsberichten of geeft deze weer.
Wanneer een gebruiker met het netwerk verbindt, worden deze
berichten naar hem/haar verzonden. (Echter, er zullen nooit
- meer dan %s berichten worden verstuurd om het flooden van de
+ meer dan %d berichten worden verstuurd om het flooden van de
gebruiker te voorkomen. Als er meer nieuwsberichten
zijn worden alleen de meest recente vestuurd.)
NewsCount kan geconfigureerd worden in services.conf.
@@ -3391,7 +3391,7 @@ NEWS_HELP_OPER
Wijzigt de lijst met oper nieuwsberichten of geeft deze weer.
Wanneer een gebruiker opert (dmv het /OPER commando), worden
deze berichtennaar hem/haar verzonden. (Echter, er zullen
- nooit meer dan %s berichten worden verstuurd om het flooden
+ nooit meer dan %d berichten worden verstuurd om het flooden
van de gebruiker te voorkomen. Als er meer nieuwsberichten
zijn worden alleen de meest recente vestuurd.)
NewsCount kan geconfigureerd worden in services.conf.
diff --git a/lang/pl.l b/lang/pl.l
index 145a700e5..7edfb3831 100644
--- a/lang/pl.l
+++ b/lang/pl.l
@@ -4392,7 +4392,7 @@ NEWS_HELP_LOGON
Edytuje lub wy¶wietla listê wiadomo¶ci wysy³anych po
przy³±czeniu u¿ytkownika do sieci. Je¶li zdefniowanych
- wiadomo¶ci jest wiêcej tylko najnowsze %s zostanie
+ wiadomo¶ci jest wiêcej tylko najnowsze %d zostanie
wys³anych (aby zapobiec floodowaniu). Warto¶æ NewsCount
mo¿e zostaæ zmieniona w pliku konfiguracyjym serwisów.
@@ -4405,7 +4405,7 @@ NEWS_HELP_OPER
Edytuje lub wy¶wietla listê wiadomo¶ci wysy³anych po
wykonaniu polecenia /OPER. Je¶li zdefiniowanych
- wiadomo¶ci jest wiêcej tylko najnowsze %s zostanie
+ wiadomo¶ci jest wiêcej tylko najnowsze %d zostanie
wys³anych (aby zapobiec floodowaniu). Warto¶æ NewsCount
mo¿e zostaæ zmieniona w pliku konfiguracyjym serwisów.
diff --git a/lang/pt.l b/lang/pt.l
index 3fe287556..fd24698fd 100644
--- a/lang/pt.l
+++ b/lang/pt.l
@@ -3325,7 +3325,7 @@ NEWS_HELP_LOGON
Edits or displays the list of logon news messages. When a
user connects to the network, these messages will be sent
- to them. (However, no more than %s messages will be
+ to them. (However, no more than %d messages will be
sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
@@ -3339,7 +3339,7 @@ NEWS_HELP_OPER
Edits or displays the list of oper news messages. When a
user opers up (with the /OPER command), these messages will
- be sent to them. (However, no more than %s messages will
+ be sent to them. (However, no more than %d messages will
be sent in order to avoid flooding the user. If there are
more news messages, only the most recent will be sent.)
NewsCount can be configured in services.conf.
diff --git a/lang/ru.l b/lang/ru.l
index 0377d836f..aa5a5847c 100644
--- a/lang/ru.l
+++ b/lang/ru.l
@@ -3299,7 +3299,7 @@ NEWS_HELP_LOGON
Ïîçâîëÿåò óïðàâëÿòü ñïèñêîì íîâîñòåé, êîòîðûå áóäóò àâòîìàòè÷åñêè
âûäàâàòüñÿ ïîëüçîâàòåëþ ñðàçó æå, êàê òîëüêî îí ïîäêëþ÷èòñÿ ê ñåòè.
Ñòîèò çàìåòèòü, ÷òî âî èçáåæàíèå ôëóäà ïîëüçîâàòåëü ïîëó÷èò òîëüêî
- %s íîâîñòü(è), òàê ÷òî åñëè ó âàñ â ñïèñêå èõ áîëüøå - ïîêàçàíû
+ %d íîâîñòü(è), òàê ÷òî åñëè ó âàñ â ñïèñêå èõ áîëüøå - ïîêàçàíû
áóäóò òîëüêî ïîñëåäíèå èç íèõ. Çíà÷åíèå NewsCount, îòâå÷àþùåå çà
îäíîâðåìåííî ïîñûëàåìîå êîë-âî íîâîñòåé, óêàçûâàåòñÿ â services.conf
@@ -3320,7 +3320,7 @@ NEWS_HELP_OPER
ïîëüçîâàòåëü ïîëó÷èò ñòàòóñ IRC-îïåðàòîðà (èñïîëüçîâàâ êîìàíäó /OPER),
äàííûå ñîîáùåíèÿ áóäóò åìó îòïðàâëåíû àâòîìàòè÷åñêè.
Ñòîèò çàìåòèòü, ÷òî âî èçáåæàíèå ôëóäà ïîëüçîâàòåëü ïîëó÷èò òîëüêî
- %s íîâîñòü(è), òàê ÷òî åñëè ó âàñ â ñïèñêå èõ áîëüøå - ïîêàçàíû
+ %d íîâîñòü(è), òàê ÷òî åñëè ó âàñ â ñïèñêå èõ áîëüøå - ïîêàçàíû
áóäóò òîëüêî ïîñëåäíèå èç íèõ. Çíà÷åíèå NewsCount, îòâå÷àþùåå çà
îäíîâðåìåííî ïîñûëàåìîå êîë-âî íîâîñòåé, óêàçûâàåòñÿ â services.conf
diff --git a/lang/tr.l b/lang/tr.l
index 102ec2167..422d83341 100644
--- a/lang/tr.l
+++ b/lang/tr.l
@@ -3418,7 +3418,7 @@ NEWS_HELP_LOGON
Giriþ haberleri ve mesajlarýný düzenlemek icin kullanýlýr.
Kullanýcý sunucuya baðlantýðý anda bu belirtilen mesajlar giris yapan kullanýcýya
- iletilir. (Bununla beraber, %s adetten fazla mesaj kullanýcýya
+ iletilir. (Bununla beraber, %d adetten fazla mesaj kullanýcýya
gonderilmez. Eðer cok fazla mesaj eklenmiþ bulunuyor ise
bunlardan en yenileri kullanýcýya ulaþtýrýlýr.)
NewsCount(Giriþ haberleri) Özellikleri services.conf'ta belirtilmiþtir ve bu dosyadan ayarlanabilir.
@@ -3432,7 +3432,7 @@ NEWS_HELP_OPER
Giriþ haberleri ve mesajlarýný düzenlemek icin kullanýlýr(Yönetici giriþleri).
Kullanýcý sunucu içerisinde yönetici konumuna gectiði anda bu belirtilen mesajlar giris yapan operatore
- iletilir. (Bununla beraber, %s adetten fazla mesaj yöneticiye
+ iletilir. (Bununla beraber, %d adetten fazla mesaj yöneticiye
gonderilmez. Eðer cok fazla mesaj eklenmiþ bulunuyor ise
bunlardan en yenileri kullanýcýya ulaþtýrýlýr.)
NewsCount(Giriþ haberleri) Özellikleri services.conf'ta belirtilmiþtir ve bu dosyadan ayarlanabilir.
diff --git a/src/channels.c b/src/channels.c
index a42aa2ec4..2318d7ef2 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1741,6 +1741,7 @@ void chan_delete(Channel * c)
while (c->bans->entries) {
entry_delete(c->bans, c->bans->entries);
}
+ free(c->bans);
}
if (ircd->except) {
@@ -1748,6 +1749,7 @@ void chan_delete(Channel * c)
while (c->excepts->entries) {
entry_delete(c->excepts, c->excepts->entries);
}
+ free(c->excepts);
}
}
@@ -1756,6 +1758,7 @@ void chan_delete(Channel * c)
while (c->invites->entries) {
entry_delete(c->invites, c->invites->entries);
}
+ free(c->invites);
}
}
@@ -1784,6 +1787,10 @@ void del_ban(Channel * chan, char *mask)
if (ban) {
entry_delete(chan->bans, ban);
+ if (chan->bans->count == 0) {
+ free(chan->bans);
+ chan->bans = NULL;
+ }
if (debug)
alog("debug: Deleted ban %s from channel %s", mask,
@@ -1808,6 +1815,10 @@ void del_exception(Channel * chan, char *mask)
if (exception) {
entry_delete(chan->excepts, exception);
+ if (chan->excepts->count == 0) {
+ free(chan->excepts);
+ chan->excepts = NULL;
+ }
if (debug)
alog("debug: Deleted except %s to channel %s", mask,
@@ -1830,6 +1841,10 @@ void del_invite(Channel * chan, char *mask)
if (invite) {
entry_delete(chan->invites, invite);
+ if(chan->invites->count == 0) {
+ free(chan->invites);
+ chan->invites = NULL;
+ }
if (debug)
alog("debug: Deleted invite %s to channel %s", mask,
diff --git a/src/config.c b/src/config.c
index 7e56996b4..bb43e7d81 100644
--- a/src/config.c
+++ b/src/config.c
@@ -220,7 +220,7 @@ char *GlobalOnCycleMessage;
char *GlobalOnCycleUP;
char *ServicesRoot;
char **ServicesRoots;
-int RootNumber;
+int RootNumber = 0;
int SuperAdmin;
int LogBot;
int LogMaxUsers;
@@ -272,8 +272,8 @@ int OSOpersOnly;
char *Modules;
char *ModulesDelayed;
char **ModulesAutoload;
-int ModulesNumber;
-int ModulesDelayedNumber;
+int ModulesNumber = 0;
+int ModulesDelayedNumber = 0;
char **ModulesDelayedAutoload;
/**
@@ -281,31 +281,31 @@ char **ModulesDelayedAutoload;
**/
char *HostCoreModules;
char **HostServCoreModules;
-int HostServCoreNumber;
+int HostServCoreNumber = 0;
char *MemoCoreModules;
char **MemoServCoreModules;
-int MemoServCoreNumber;
+int MemoServCoreNumber = 0;
char *HelpCoreModules;
char **HelpServCoreModules;
-int HelpServCoreNumber;
+int HelpServCoreNumber = 0;
char *BotCoreModules;
char **BotServCoreModules;
-int BotServCoreNumber;
+int BotServCoreNumber = 0;
char *OperCoreModules;
char **OperServCoreModules;
-int OperServCoreNumber;
+int OperServCoreNumber = 0;
char *NickCoreModules;
char **NickServCoreModules;
-int NickServCoreNumber;
+int NickServCoreNumber = 0;
char *ChanCoreModules;
char **ChanServCoreModules;
-int ChanServCoreNumber;
+int ChanServCoreNumber = 0;
char *MysqlHost;
@@ -346,7 +346,7 @@ int UnRestrictSAdmin;
char *UlineServers;
char **Ulines;
-int NumUlines;
+int NumUlines = 0;
int UseTS6;
@@ -774,8 +774,7 @@ int parse_directive(Directive * d, char *dir, int ac, char *av[MAXPARAMS],
*(int *) d->params[i].ptr = val;
break;
case PARAM_STRING:
-/* if (reload && *(char **)d->params[i].ptr)
- free(*(char **)d->params[i].ptr); */
+ Anope_Free(*(char **)d->params[i].ptr);
*(char **) d->params[i].ptr = sstrdup(av[optind++]);
if (!d->params[i].ptr) {
error(linenum, "%s: Out of memory", d->name);
@@ -1247,7 +1246,8 @@ int read_config(int reload)
/* Services Root building */
if (ServicesRoot && !reload) { /* Check to prevent segmentation fault if it's missing */
- RootNumber = 0;
+ while( RootNumber )
+ free(ServicesRoots[--RootNumber]);
s = strtok(ServicesRoot, " ");
do {
@@ -1268,7 +1268,8 @@ int read_config(int reload)
/* Ulines */
if (UlineServers) {
- NumUlines = 0;
+ while( NumUlines )
+ free(Ulines[--NumUlines]);
s = strtok(UlineServers, " ");
do {
@@ -1281,30 +1282,56 @@ int read_config(int reload)
}
/* Host Setters building... :P */
+ while( HostNumber )
+ free(HostSetters[--HostNumber]);
+ Anope_Free(HostSetters);
HostSetters = buildStringList(HostSetter, &HostNumber);
/* Modules Autoload building... :P */
+ while( ModulesNumber )
+ free(ModulesAutoload[--ModulesNumber]);
+ Anope_Free(ModulesAutoload);
ModulesAutoload = buildStringList(Modules, &ModulesNumber);
- ModulesDelayedAutoload =
- buildStringList(ModulesDelayed, &ModulesDelayedNumber);
- HostServCoreModules =
- buildStringList(HostCoreModules, &HostServCoreNumber);
- MemoServCoreModules =
- buildStringList(MemoCoreModules, &MemoServCoreNumber);
- HelpServCoreModules =
- buildStringList(HelpCoreModules, &HelpServCoreNumber);
- BotServCoreModules =
- buildStringList(BotCoreModules, &BotServCoreNumber);
+ while( ModulesDelayedNumber )
+ free(ModulesDelayedAutoload[--ModulesDelayedNumber]);
+ Anope_Free(ModulesDelayedAutoload);
+ ModulesDelayedAutoload = buildStringList(ModulesDelayed, &ModulesDelayedNumber);
- OperServCoreModules =
- buildStringList(OperCoreModules, &OperServCoreNumber);
+ while( HostServCoreNumber )
+ free(HostServCoreModules[--HostServCoreNumber]);
+ Anope_Free(HostServCoreModules);
+ HostServCoreModules = buildStringList(HostCoreModules, &HostServCoreNumber);
- ChanServCoreModules =
- buildStringList(ChanCoreModules, &ChanServCoreNumber);
+ while( MemoServCoreNumber )
+ free(MemoServCoreModules[--MemoServCoreNumber]);
+ Anope_Free(MemoServCoreModules);
+ MemoServCoreModules = buildStringList(MemoCoreModules, &MemoServCoreNumber);
- NickServCoreModules =
- buildStringList(NickCoreModules, &NickServCoreNumber);
+ while( HelpServCoreNumber )
+ free(HelpServCoreModules[--HelpServCoreNumber]);
+ Anope_Free(HelpServCoreModules);
+ HelpServCoreModules = buildStringList(HelpCoreModules, &HelpServCoreNumber);
+
+ while( BotServCoreNumber )
+ free(BotServCoreModules[--BotServCoreNumber]);
+ Anope_Free(BotServCoreModules);
+ BotServCoreModules = buildStringList(BotCoreModules, &BotServCoreNumber);
+
+ while( OperServCoreNumber )
+ free(OperServCoreModules[--OperServCoreNumber]);
+ Anope_Free(OperServCoreModules);
+ OperServCoreModules = buildStringList(OperCoreModules, &OperServCoreNumber);
+
+ while( ChanServCoreNumber )
+ free(ChanServCoreModules[--ChanServCoreNumber]);
+ Anope_Free(ChanServCoreModules);
+ ChanServCoreModules = buildStringList(ChanCoreModules, &ChanServCoreNumber);
+
+ while( NickServCoreNumber )
+ free(NickServCoreModules[--NickServCoreNumber]);
+ Anope_Free(NickServCoreModules);
+ NickServCoreModules = buildStringList(NickCoreModules, &NickServCoreNumber);
if (LimitSessions) {
@@ -1413,6 +1440,7 @@ int read_config(int reload)
CHECK(UseMail);
CHECK(NSForceEmail);
} else {
+ Anope_Free(PreNickDBName);
PreNickDBName = NULL;
NSRExpire = 0;
}
diff --git a/src/core/cs_set.c b/src/core/cs_set.c
index 7138a2054..f82a74c78 100644
--- a/src/core/cs_set.c
+++ b/src/core/cs_set.c
@@ -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;
+}
diff --git a/src/core/ms_set.c b/src/core/ms_set.c
index 6d625acb5..19f7de7ad 100644
--- a/src/core/ms_set.c
+++ b/src/core/ms_set.c
@@ -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;
+}
diff --git a/src/core/os_logonnews.c b/src/core/os_logonnews.c
index cb01fcfff..78353be47 100644
--- a/src/core/os_logonnews.c
+++ b/src/core/os_logonnews.c
@@ -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;
}
diff --git a/src/core/os_opernews.c b/src/core/os_opernews.c
index 5748f8904..773d1b3f6 100644
--- a/src/core/os_opernews.c
+++ b/src/core/os_opernews.c
@@ -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_UN