From 42848b7219afc576f0550f5cbe9f6706d72ff6ac Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 5 May 1995 03:58:57 +0000 Subject: prof_tree.c (profile_free_node): Copy child->next to a scratch pointer before freeing the node; otherwise we have to dereference a freed object. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5725 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/profile/prof_tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/util/profile/prof_tree.c') diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c index c39831955e..5cb86c92c9 100644 --- a/src/util/profile/prof_tree.c +++ b/src/util/profile/prof_tree.c @@ -45,7 +45,7 @@ struct profile_node { void profile_free_node(node) struct profile_node *node; { - struct profile_node *child; + struct profile_node *child, *next; if (node->magic != PROF_MAGIC_NODE) return; @@ -54,8 +54,10 @@ void profile_free_node(node) free(node->name); if (node->value) free(node->value); - for (child=node->first_child; child; child = child->next) + for (child=node->first_child; child; child = next) { + next = child->next; profile_free_node(child); + } node->magic = 0; free(node); -- cgit