summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/util/profile/ChangeLog6
-rw-r--r--src/util/profile/prof_tree.c6
-rw-r--r--src/util/profile/profile.hin1
3 files changed, 10 insertions, 3 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog
index aa0d55a5e..3bf2b274f 100644
--- a/src/util/profile/ChangeLog
+++ b/src/util/profile/ChangeLog
@@ -1,3 +1,9 @@
+Thu May 4 23:57:56 1995 Theodore Y. Ts'o (tytso@dcl)
+
+ * 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.
+
Fri Apr 28 15:54:40 1995 Theodore Y. Ts'o <tytso@dcl>
* prof_parse.c (strip_line): Don't try to strip an empty line.
diff --git a/src/util/profile/prof_tree.c b/src/util/profile/prof_tree.c
index c39831955..5cb86c92c 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);
diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin
index 3c0d9df95..eca64fbe9 100644
--- a/src/util/profile/profile.hin
+++ b/src/util/profile/profile.hin
@@ -20,7 +20,6 @@ extern void profile_release
extern long profile_get_values
PROTOTYPE ((profile_t profile, const char **names, char ***ret_values));
-
extern long profile_get_string
PROTOTYPE((profile_t profile, const char *name, const char *subname,
const char *subsubname, const char *def_val,