Fix a few more minor memory leaks.

This patch fixes a few more memory leaks that can happen under
error conditions.
This commit is contained in:
Cary R 2009-08-11 16:35:49 -07:00 committed by Stephen Williams
parent 2e820ca6f0
commit 35f3d7f60e
3 changed files with 11 additions and 2 deletions

View File

@ -293,7 +293,10 @@ static PLI_INT32 sys_readmem_calltf(PLI_BYTE8*name)
if (process_params(mitem, start_item, stop_item, callh, name,
&start_addr, &stop_addr, &addr_incr,
&min_addr, &max_addr)) return 0;
&min_addr, &max_addr)) {
free(fname);
return 0;
}
/* Open the data file. */
file = fopen(fname, "r");
@ -528,7 +531,10 @@ static PLI_INT32 sys_writemem_calltf(PLI_BYTE8*name)
if (process_params(mitem, start_item, stop_item, callh, name,
&start_addr, &stop_addr, &addr_incr,
&min_addr, &max_addr)) return 0;
&min_addr, &max_addr)) {
free(fname);
return 0;
}
/* Open the data file. */
file = fopen(fname, "w");

View File

@ -626,6 +626,7 @@ static PLI_INT32 sys_fscanf_compiletf(PLI_BYTE8*name)
(int)vpi_get(vpiLineNo, callh));
vpi_printf("%s's first argument (fd) must be numeric.\n", name);
vpi_control(vpiFinish, 1);
vpi_free_object(argv);
return 0;
}
@ -695,6 +696,7 @@ static PLI_INT32 sys_sscanf_compiletf(PLI_BYTE8*name)
vpi_printf("%s's first argument must be a register or constant "
"string.\n", name);
vpi_control(vpiFinish, 1);
vpi_free_object(argv);
return 0;
}

View File

@ -805,6 +805,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
vpi_printf("VCD warning: skipping signal %s, "
"it was previously included.\n",
fullname);
free(scname);
continue;
} else {
add_var = 1;