svn rev #24274: trunk/src/util/profile/
ghudson@MIT.EDU
ghudson at MIT.EDU
Sun Aug 29 18:35:41 EDT 2010
http://src.mit.edu/fisheye/changelog/krb5/?cs=24274
Commit By: ghudson
Log Message:
ticket: 6761
Fix a resource leak in the profile include support.
Changed Files:
U trunk/src/util/profile/prof_parse.c
Modified: trunk/src/util/profile/prof_parse.c
===================================================================
--- trunk/src/util/profile/prof_parse.c 2010-08-29 18:06:06 UTC (rev 24273)
+++ trunk/src/util/profile/prof_parse.c 2010-08-29 22:35:41 UTC (rev 24274)
@@ -241,7 +241,7 @@
{
DIR *dir;
char *pathname;
- errcode_t retval;
+ errcode_t retval = 0;
struct dirent *ent;
dir = opendir(dirname);
@@ -250,14 +250,17 @@
while ((ent = readdir(dir)) != NULL) {
if (!valid_name(ent->d_name))
continue;
- if (asprintf(&pathname, "%s/%s", dirname, ent->d_name) < 0)
- return ENOMEM;
+ if (asprintf(&pathname, "%s/%s", dirname, ent->d_name) < 0) {
+ retval = ENOMEM;
+ break;
+ }
retval = parse_include_file(pathname, state);
free(pathname);
if (retval)
- return retval;
+ break;
}
- return 0;
+ closedir(dir);
+ return retval;
}
static errcode_t parse_line(char *line, struct parse_state *state)
More information about the cvs-krb5
mailing list