Remove memory leak when checking if a package has any dumpable items

This commit is contained in:
Cary R 2026-01-21 20:48:30 -08:00
parent 068f33b35a
commit 128d970d60
2 changed files with 8 additions and 4 deletions

View File

@ -676,7 +676,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
case vpiParameter: case vpiParameter:
/* If we are skipping all pamaeters then just return. */ /* If we are skipping all parameters then just return. */
if (skip) return; if (skip) return;
size = vpi_get(vpiSize, item); size = vpi_get(vpiSize, item);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003-2025 Stephen Williams (steve@icarus.com) * Copyright (c) 2003-2026 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -51,12 +51,16 @@ int is_escaped_id(const char *name)
return 1; return 1;
} }
/* Check if there are any things that could be dumped in this item. */
int vcd_instance_contains_dumpable_items(const int dumpable_types[], vpiHandle item) int vcd_instance_contains_dumpable_items(const int dumpable_types[], vpiHandle item)
{ {
int i; int i;
for (i = 0; dumpable_types[i] > 0; i++) { for (i = 0; dumpable_types[i] > 0; i++) {
if (vpi_iterate(dumpable_types[i], item)) vpiHandle iter = vpi_iterate(dumpable_types[i], item);
return 1; if (iter) {
vpi_release_handle(iter);
return 1;
}
} }
return 0; return 0;
} }