for (cursor = el; cursor->next != NULL; cursor = cursor->next)
{
if (cursor->ed == ed) {
- return false;
+ /* The entry already exists in this list. */
+ return true;
}
}
if (cursor->ed == ed) {
- return false;
+ /* The entry already exists in this list. */
+ return true;
}
el_new = nwrap_entlist_init(ed);
struct nwrap_entdata *ed;
struct nwrap_entlist *el;
size_t i;
+ int rc;
nwrap_vector_foreach (ed, nwrap_he->entries, i)
{
nwrap_he->num = 0;
nwrap_he->idx = 0;
+
+ /*
+ * If we unload the file, the pointers in the hash table point to
+ * invalid memory. So we need to destroy the hash table and recreate
+ * it.
+ */
+ hdestroy();
+ rc = hcreate(max_hostents);
+ if (rc == 0) {
+ NWRAP_LOG(NWRAP_LOG_ERROR, "Failed to initialize hash table");
+ exit(-1);
+ }
}
nwrap_he_global.num = 0;
}
+ free(user_addrlist.items);
+#ifdef HAVE_GETHOSTBYNAME2
+ free(user_addrlist2.items);
+#endif
+
hdestroy();
NWRAP_UNLOCK_ALL;
}