diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 89bc8af03..1281ca67c 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2004-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -90,6 +90,7 @@ void* vvp_net_t::operator new (size_t size) static map vvp_net_map; static map sfunc_map; static map udp_map; +static map resolv_map; static vvp_net_t **local_net_pool = 0; static unsigned local_net_pool_count = 0; @@ -110,6 +111,9 @@ void vvp_net_delete(vvp_net_t *item) if (vvp_udp_fun_core*tmp = dynamic_cast (item->fun)) { udp_map[tmp] = true; } + if (resolv_core*tmp = dynamic_cast(item->fun)) { + resolv_map[tmp] = true; + } } void vvp_net_pool_delete() @@ -142,6 +146,12 @@ void vvp_net_pool_delete() } udp_map.clear(); + map::iterator riter; + for (riter = resolv_map.begin(); riter != resolv_map.end(); ++ riter ) { + delete riter->first; + } + resolv_map.clear(); + if (RUNNING_ON_VALGRIND && (vvp_nets_del != count_vvp_nets)) { fflush(NULL); VALGRIND_PRINTF("Error: vvp missed deleting %ld of %lu net(s).", @@ -244,7 +254,9 @@ void vvp_net_t::count_drivers(unsigned idx, unsigned counts[4]) void vvp_net_fun_t::operator delete(void*) { +#ifndef CHECK_WITH_VALGRIND assert(0); +#endif }