Fix more memory leaks in vvp and one in ivlpp.

This patch fixes some more memory leaks in vvp. Mostly related
to UDP compilation and one in find_scope() that was found when
testing the VPI code. The leak in ivlpp was that the define
temporary buffer not being freed when the lexor was finished.
This commit is contained in:
Cary R 2009-01-13 14:28:30 -08:00 committed by Stephen Williams
parent ea954a7ccc
commit 2707a68d1b
4 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,6 @@
%{
/*
* Copyright (c) 1999-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2009 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
@ -1812,4 +1812,5 @@ void destroy_lexor()
# endif
# endif
# endif
free(def_buf);
}

View File

@ -1492,6 +1492,7 @@ void compile_udp_def(int sequ, char *label, char *name,
u->compile_table(table);
}
free(label);
delete[] name;
}
char **compile_udp_table(char **table, char *row)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2005-2009 Stephen Williams (steve@icarus.com)
*
* (This is a rewrite of code that was ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@ -247,7 +247,9 @@ void vvp_udp_comb_s::compile_table(char**tab)
default:
break;
}
delete[] tab[idx];
}
free(tab);
assert(nrows0 == nlevels0_);
assert(nrows1 == nlevels1_);
@ -623,7 +625,9 @@ void vvp_udp_seq_s::compile_table(char**tab)
}
}
delete[] tab[idx];
}
free(tab);
assert(idx_edg0 == nedges0_);
assert(idx_edg1 == nedges1_);
@ -942,6 +946,7 @@ void compile_udp_functor(char*label, char*type,
if (delay != 0) {
vvp_net_t*net_drv = new vvp_net_t;
vvp_fun_delay*obj_drv = new vvp_fun_delay(net_drv, BIT4_X, *delay);
delete delay;
net_drv->fun = obj_drv;
ptr->out = vvp_net_ptr_t(net_drv,0);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2009 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
@ -908,7 +908,10 @@ static vpiHandle find_scope(const char *name, vpiHandle handle, int depth)
rtn = find_scope(cp+1, hand, depth + 1);
/* found it yet ? */
if (rtn) break;
if (rtn) {
vpi_free_object(iter);
break;
}
}
/* matched up to here */