Segfault when freeing a method
Julien ÉLIE
julien at trigofacile.com
Sat Sep 27 12:56:24 UTC 2008
Hi,
I see that readers.conf handles group blocks like:
group {
hosts: "*"
auth test {
python_auth: "script"
}
auth test2 {
perl_auth: "/path/to/script.pl"
key: "test"
}
}
but when I play with it, I sometimes obtain:
*** glibc detected *** double free or corruption (out): 0xb7afd4f8 ***
It comes from here:
typedef struct _METHOD {
char *name;
char *program;
int type; /* type of auth (perl, python or external) */
char *users; /* only used for auth_methods, not for res_methods. */
char **extra_logs;
} METHOD;
static void
free_method(METHOD *del)
{
if (del->program)
free(del->program);
free(del->name);
free(del);
}
gdb shows me that del->name is an empty string (del->name[0] = '\0').
It sefaults when it is freed.
del->name comes from a previous xstrdup() during copy_method().
However, even if I put "if (del->name)" or "if (del->name != NULL)",
it is also freed and segfaults...
--> What is the condition to put for it not to be freed?
I believe I should not put (*del->name != NULL), shouldn't I?
Otherwise, it is the whole file which has a problem...
--
Julien ÉLIE
« Les idées fausses ne sont pas toujours mauvaises. » (Marcel Aymé)
More information about the inn-workers
mailing list