diff options
author | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2006-06-13 10:27:52 +0000 |
---|---|---|
committer | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2006-06-13 10:27:52 +0000 |
commit | d4674e1e67acaba9769d63c3ca2b95f7b5068288 (patch) | |
tree | e8087da63c1fbb5578305a84935ec295ed106aa0 /src | |
parent | f1d0119044a2698c24243be1f46a06c556aaa456 (diff) |
BUILD : 1.7.14 (1046) BUGS : NOTES : We were walking memory in moduleGetConfigDirecte with an allocated pointer, and free-ing it later when it was past the allocatrd space... We now store the original pointer so we can free it correctly :)
git-svn-id: svn://svn.anope.org/anope/trunk@1046 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@770 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/modules.c b/src/modules.c index 3c34f3994..ee9e351b0 100644 --- a/src/modules.c +++ b/src/modules.c @@ -2425,6 +2425,7 @@ int moduleGetConfigDirective(Directive * d) int linenum = 0; int ac = 0; char *av[MAXPARAMS]; + char *str = NULL; char *s = NULL; char *t = NULL; int retval = 1; @@ -2440,17 +2441,18 @@ int moduleGetConfigDirective(Directive * d) continue; dir = myStrGetOnlyToken(buf, '\t', 0); if (dir) { - s = myStrGetTokenRemainder(buf, '\t', 1); + str = myStrGetTokenRemainder(buf, '\t', 1); } else { dir = myStrGetOnlyToken(buf, ' ', 0); if (dir || (dir = myStrGetOnlyToken(buf, '\n', 0))) { - s = myStrGetTokenRemainder(buf, ' ', 1); + str = myStrGetTokenRemainder(buf, ' ', 1); } else { continue; } } if (stricmp(dir, d->name) == 0) { - if (s) { + if (str) { + s = str; while (isspace(*s)) s++; while (*s) { @@ -2484,10 +2486,10 @@ int moduleGetConfigDirective(Directive * d) retval = parse_directive(d, dir, ac, av, linenum, 0, s); } } - if (dir)
- free(dir);
- if (s)
- free(s); + if (dir) + free(dir); + if (str) + free(str); fclose(config); return retval; } |