--- a/src/kv_list.c Thu Sep 11 20:09:33 2025 +0200 +++ b/src/kv_list.c Thu Sep 11 20:10:12 2025 +0200 @@ -357,9 +357,6 @@ // reallocate the list to add memory for storing the metadata cx_kv_list *kv_list = cxRealloc(allocator, list, sizeof(struct cx_kv_list_s)); - // zero the custom destructor information - memset((char*)kv_list + offsetof(cx_kv_list, list_destr), 0, sizeof(void*)*6); - // if any of the reallocations failed, we bail out if (kv_map != NULL && kv_list != NULL) { map = (CxMap*) kv_map; @@ -370,6 +367,9 @@ return NULL; } // LCOV_EXCL_STOP + // zero the custom destructor information + memset((char*)kv_list + offsetof(cx_kv_list, list_destr), 0, sizeof(void*)*6); + // combine the list and the map aspect kv_list->map = kv_map; kv_map->list = kv_list;