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:
parent
2e820ca6f0
commit
35f3d7f60e
|
|
@ -293,7 +293,10 @@ static PLI_INT32 sys_readmem_calltf(PLI_BYTE8*name)
|
||||||
|
|
||||||
if (process_params(mitem, start_item, stop_item, callh, name,
|
if (process_params(mitem, start_item, stop_item, callh, name,
|
||||||
&start_addr, &stop_addr, &addr_incr,
|
&start_addr, &stop_addr, &addr_incr,
|
||||||
&min_addr, &max_addr)) return 0;
|
&min_addr, &max_addr)) {
|
||||||
|
free(fname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Open the data file. */
|
/* Open the data file. */
|
||||||
file = fopen(fname, "r");
|
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,
|
if (process_params(mitem, start_item, stop_item, callh, name,
|
||||||
&start_addr, &stop_addr, &addr_incr,
|
&start_addr, &stop_addr, &addr_incr,
|
||||||
&min_addr, &max_addr)) return 0;
|
&min_addr, &max_addr)) {
|
||||||
|
free(fname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Open the data file. */
|
/* Open the data file. */
|
||||||
file = fopen(fname, "w");
|
file = fopen(fname, "w");
|
||||||
|
|
|
||||||
|
|
@ -626,6 +626,7 @@ static PLI_INT32 sys_fscanf_compiletf(PLI_BYTE8*name)
|
||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
vpi_printf("%s's first argument (fd) must be numeric.\n", name);
|
vpi_printf("%s's first argument (fd) must be numeric.\n", name);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
vpi_free_object(argv);
|
||||||
return 0;
|
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 "
|
vpi_printf("%s's first argument must be a register or constant "
|
||||||
"string.\n", name);
|
"string.\n", name);
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
|
vpi_free_object(argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -805,6 +805,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
|
||||||
vpi_printf("VCD warning: skipping signal %s, "
|
vpi_printf("VCD warning: skipping signal %s, "
|
||||||
"it was previously included.\n",
|
"it was previously included.\n",
|
||||||
fullname);
|
fullname);
|
||||||
|
free(scname);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
add_var = 1;
|
add_var = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue