summaryrefslogtreecommitdiffstats
path: root/src/util/profile/prof_parse.c
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2007-09-26 15:15:33 +0000
committerEzra Peisach <epeisach@mit.edu>2007-09-26 15:15:33 +0000
commitcf3a311a561ade506913c4ba0e38b6e5adf9f9b4 (patch)
tree6e6f9c9674dda75178f76baf3bfb8b2ae6ae8950 /src/util/profile/prof_parse.c
parent15b107eb626219ec807730f36c73a1e3fb4b35a4 (diff)
downloadkrb5-cf3a311a561ade506913c4ba0e38b6e5adf9f9b4.tar.gz
krb5-cf3a311a561ade506913c4ba0e38b6e5adf9f9b4.tar.xz
krb5-cf3a311a561ade506913c4ba0e38b6e5adf9f9b4.zip
profile library memory leaks introduced when malloc returns 0
I have a modified version of valgrind that will allow me to have malloc fail in a controlled way. A number of memory leaks in error return passes exist in the profile library. They are essentially inconsequental - but my goal is to eventually create a test harness that tries to cover all code - including error returns... prof_parse.c: (profile_parse_file): Free node being created if parse_line() fails. prof_file.c (profile_open_file): free prf_data_t on malloc failure prof_tree.c (profile_create_node): The magic element must be set before calling profile_free_node for it to release memory. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19981 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile/prof_parse.c')
-rw-r--r--src/util/profile/prof_parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c
index db491591d4..665b9d90c3 100644
--- a/src/util/profile/prof_parse.c
+++ b/src/util/profile/prof_parse.c
@@ -242,6 +242,7 @@ errcode_t profile_parse_file(FILE *f, struct profile_node **root)
#ifndef PROFILE_SUPPORTS_FOREIGN_NEWLINES
retval = parse_line(bptr, &state);
if (retval) {
+ profile_free_node(state.root_section);
free (bptr);
return retval;
}
@@ -286,6 +287,7 @@ errcode_t profile_parse_file(FILE *f, struct profile_node **root)
newp = p + strlen (p) + 1;
retval = parse_line (p, &state);
if (retval) {
+ profile_free_node(state.root_section);
free (bptr);
return retval;
}