1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 18:43:13 +02:00

Fix dumb modules

This commit is contained in:
Adam
2013-07-25 20:31:51 -04:00
parent def6a6deee
commit a563c8fb2f
3 changed files with 14 additions and 2 deletions
+5 -1
View File
@@ -774,7 +774,11 @@ int parse_directive(Directive * d, char *dir, int ac, char *av[MAXPARAMS],
*(int *) d->params[i].ptr = val;
break;
case PARAM_STRING:
Anope_Free(*(char **)d->params[i].ptr);
/*
* Anope_Free(*(char **)d->params[i].ptr);
* Historically dumb modules pass uninitialized values here so
* we can't free this
*/
*(char **) d->params[i].ptr = sstrdup(av[optind++]);
if (!d->params[i].ptr) {
error(linenum, "%s: Out of memory", d->name);
+8
View File
@@ -2563,6 +2563,14 @@ int moduleGetConfigDirective(Directive * d)
char *s = NULL;
char *t = NULL;
int retval = 1;
int i;
/* Dumb modules pass uninitialized string pointers here. Dumb people will not add the proper configuration values to services.conf.
* Combine the two and you end up with parse_directive never setting the char* pointers passed here. So, null them out now.
*/
for (i = 0; i < MAXPARAMS && d->params[i].type != PARAM_NONE; i++)
if (d->params[i].type == PARAM_STRING)
*(char **) d->params[i].ptr = NULL;
config = fopen(SERVICES_CONF, "r");
if (!config) {
+1 -1
View File
@@ -8,7 +8,7 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="9"
VERSION_EXTRA="-git"
VERSION_BUILD="3121"
VERSION_BUILD="3122"
# Changes since 1.8.8 Release
#Revision 3120 - Fix many memory leaks and valgrind warnings, see pull request #15