fix memory leak from reading nsswitch.conf

MFC after:	1 week
This commit is contained in:
jon 2007-05-17 03:33:23 +00:00
parent fe7fa59a06
commit 3127d2bb31
2 changed files with 7 additions and 0 deletions

View File

@ -412,6 +412,8 @@ static void
ns_dbt_free(ns_dbt *dbt)
{
ns_src_free(&dbt->srclist, dbt->srclistsize);
if (dbt->name)
free((void *)dbt->name);
}

View File

@ -82,6 +82,9 @@ Lines
Entry
: NL
| Database ':' NL
{
free((char*)curdbt.name);
}
| Database ':' Srclist NL
{
_nsdbtput(&curdbt);
@ -163,6 +166,7 @@ _nsaddsrctomap(elem)
syslog(LOG_ERR,
"NSSWITCH(nsparser): %s line %d: 'compat' used with sources, other than 'cache'",
_PATH_NS_CONF, lineno);
free((void*)elem);
return;
}
}
@ -171,6 +175,7 @@ _nsaddsrctomap(elem)
syslog(LOG_ERR,
"NSSWITCH(nsparser): %s line %d: duplicate source '%s'",
_PATH_NS_CONF, lineno, elem);
free((void*)elem);
return;
}
}