Fix a few memory leaks in vvp.

This patch fixes two memory leaks in the compile stage and one easy
fix in vpi/sys_display.c.
This commit is contained in:
Cary R 2009-01-21 16:16:49 -08:00 committed by Stephen Williams
parent ba8688c0d1
commit ad3fcf3455
3 changed files with 15 additions and 1 deletions

View File

@ -1615,6 +1615,12 @@ static PLI_INT32 sys_end_of_compile(p_cb_data cb_data)
return 0;
}
static PLI_INT32 sys_end_of_simulation(p_cb_data cb_data)
{
free(timeformat_info.suff);
return 0;
}
static PLI_INT32 sys_timeformat_compiletf(PLI_BYTE8*name)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
@ -2166,7 +2172,13 @@ void sys_display_register()
vpi_register_systf(&tf_data);
cb_data.reason = cbEndOfCompile;
cb_data.time = 0;
cb_data.cb_rtn = sys_end_of_compile;
cb_data.user_data = "system";
vpi_register_cb(&cb_data);
cb_data.reason = cbEndOfSimulation;
cb_data.cb_rtn = sys_end_of_simulation;
cb_data.user_data = "system";
vpi_register_cb(&cb_data);
}

View File

@ -660,6 +660,7 @@ void compile_cleanup(void)
sym_functors = 0;
compile_island_cleanup();
compile_array_cleanup();
if (verbose_flag) {
fprintf(stderr, " ... Compiletf functions\n");

View File

@ -1,7 +1,7 @@
%{
/*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-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
@ -1015,5 +1015,6 @@ int compile_design(const char*path)
}
int rc = yyparse();
fclose(yyin);
return rc;
}