summaryrefslogtreecommitdiffstats
path: root/src/util/profile/prof_tree.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1995-05-05 03:58:57 +0000
committerTheodore Tso <tytso@mit.edu>1995-05-05 03:58:57 +0000
commit42848b7219afc576f0550f5cbe9f6706d72ff6ac (patch)
tree6058e43fa8ac5d78e7f368129e88fbcc63d82867 /src/util/profile/prof_tree.c
parentc7b0d01002cf973d8ea64d181930087844921e1f (diff)
downloadkrb5-42848b7219afc576f0550f5cbe9f6706d72ff6ac.tar.gz
krb5-42848b7219afc576f0550f5cbe9f6706d72ff6ac.tar.xz
krb5-42848b7219afc576f0550f5cbe9f6706d72ff6ac.zip
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
Diffstat (limited to 'src/util/profile/prof_tree.c')
-rw-r--r--src/util/profile/prof_tree.c6
1 files changed, 4 insertions, 2 deletions
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);