vpi_free_object() is just a stub for vpiCallback objects.
The code was using vpi_free_object() to free a vpiCallback object and that was creating a memory leak since this is a do nothing routine. You need to explicitly use delete.
This commit is contained in:
parent
99a5d4ca9e
commit
87541ce335
|
|
@ -109,6 +109,9 @@ vpiHandle vpip_make_named_event(const char*name, vvp_net_t*funct)
|
|||
* vpi_remove_cb doesn't actually remove any callbacks, it marks them
|
||||
* as canceled by clearing the cb_rtn function. This function reaps
|
||||
* those marked handles when it scans the list.
|
||||
*
|
||||
* We can not use vpi_free_object() here since it does not really
|
||||
* delete the callback.
|
||||
*/
|
||||
void vpip_run_named_event_callbacks(vpiHandle ref)
|
||||
{
|
||||
|
|
@ -129,13 +132,13 @@ void vpip_run_named_event_callbacks(vpiHandle ref)
|
|||
} else if (prev == 0) {
|
||||
obj->callbacks = next;
|
||||
cur->next = 0;
|
||||
vpi_free_object(&cur->base);
|
||||
delete cur;
|
||||
|
||||
} else {
|
||||
assert(prev->next == cur);
|
||||
prev->next = next;
|
||||
cur->next = 0;
|
||||
vpi_free_object(&cur->base);
|
||||
delete cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue