PERFORCE change 132807 for review
John Birrell
jb at FreeBSD.org
Tue Jan 8 12:44:16 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=132807
Change 132807 by jb at jb_freebsd1 on 2008/01/08 20:44:11
Free memory when finished.
Affected files ...
.. //depot/projects/dtrace/src/lib/libdwarf/dwarf_finish.c#2 edit
Differences ...
==== //depot/projects/dtrace/src/lib/libdwarf/dwarf_finish.c#2 (text+ko) ====
@@ -32,9 +32,17 @@
int
dwarf_finish(Dwarf_Debug *dbgp, Dwarf_Error *error)
{
+ Dwarf_Abbrev ab;
+ Dwarf_Abbrev tab;
+ Dwarf_Attribute at;
+ Dwarf_Attribute tat;
+ Dwarf_AttrValue av;
+ Dwarf_AttrValue tav;
Dwarf_CU cu;
Dwarf_CU tcu;
Dwarf_Debug dbg;
+ Dwarf_Die die;
+ Dwarf_Die tdie;
if (error == NULL)
/* Can only return a generic error. */
@@ -50,6 +58,30 @@
/* Free entries in the compilation unit list. */
STAILQ_FOREACH_SAFE(cu, &dbg->dbg_cu, cu_next, tcu) {
+ /* Free entries in the die list */
+ STAILQ_FOREACH_SAFE(die, &cu->cu_die, die_next, tdie) {
+ /* Free entries in the attribute value list */
+ STAILQ_FOREACH_SAFE(av, &die->die_attrval, av_next, tav) {
+ STAILQ_REMOVE(&die->die_attrval, av, _Dwarf_AttrValue, av_next);
+ free(av);
+ }
+
+ STAILQ_REMOVE(&cu->cu_die, die, _Dwarf_Die, die_next);
+ free(die);
+ }
+
+ /* Free entries in the abbrev list */
+ STAILQ_FOREACH_SAFE(ab, &cu->cu_abbrev, a_next, tab) {
+ /* Free entries in the attribute list */
+ STAILQ_FOREACH_SAFE(at, &ab->a_attrib, at_next, tat) {
+ STAILQ_REMOVE(&ab->a_attrib, at, _Dwarf_Attribute, at_next);
+ free(at);
+ }
+
+ STAILQ_REMOVE(&cu->cu_abbrev, ab, _Dwarf_Abbrev, a_next);
+ free(ab);
+ }
+
STAILQ_REMOVE(&dbg->dbg_cu, cu, _Dwarf_CU, cu_next);
free(cu);
}
More information about the p4-projects
mailing list