Track the list heads in a vector in the newrap_he_global
struct and free the structures upon nwrap_he_unload.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
struct nwrap_cache *cache;
struct nwrap_vector entries;
struct nwrap_cache *cache;
struct nwrap_vector entries;
+ struct nwrap_vector lists;
ENTRY e;
ENTRY *p;
struct nwrap_entlist *el;
ENTRY e;
ENTRY *p;
struct nwrap_entlist *el;
if (h_name == NULL) {
NWRAP_LOG(NWRAP_LOG_ERROR, "h_name NULL - can't add");
if (h_name == NULL) {
NWRAP_LOG(NWRAP_LOG_ERROR, "h_name NULL - can't add");
+ ok = nwrap_vector_add_item(&(nwrap_he_global.lists), (void *)el);
+ if (!ok) {
+ NWRAP_LOG(NWRAP_LOG_ERROR,
+ "Failed to add list entry to vector.");
+ return false;
+ }
+
struct nwrap_he *nwrap_he =
(struct nwrap_he *)nwrap->private_data;
struct nwrap_entdata *ed;
struct nwrap_he *nwrap_he =
(struct nwrap_he *)nwrap->private_data;
struct nwrap_entdata *ed;
+ struct nwrap_entlist *el;
size_t i;
nwrap_vector_foreach (ed, nwrap_he->entries, i)
size_t i;
nwrap_vector_foreach (ed, nwrap_he->entries, i)
SAFE_FREE(nwrap_he->entries.items);
nwrap_he->entries.count = nwrap_he->entries.capacity = 0;
SAFE_FREE(nwrap_he->entries.items);
nwrap_he->entries.count = nwrap_he->entries.capacity = 0;
+ nwrap_vector_foreach(el, nwrap_he->lists, i)
+ {
+ while (el != NULL) {
+ struct nwrap_entlist *el_next;
+
+ el_next = el->next;
+ SAFE_FREE(el);
+ el = el_next;
+ }
+ }
+ SAFE_FREE(nwrap_he->lists.items);
+ nwrap_he->lists.count = nwrap_he->lists.capacity = 0;
+
nwrap_he->num = 0;
nwrap_he->idx = 0;
}
nwrap_he->num = 0;
nwrap_he->idx = 0;
}