Avoid using free memory, found by IBM checker.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16946 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -155,19 +155,20 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
|
||||
fd = open(path, O_WRONLY|O_CREAT, 0600);
|
||||
if (fd < 0) {
|
||||
free(path);
|
||||
ret = errno;
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: error opening file %s",
|
||||
path);
|
||||
return errno;
|
||||
free(path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (fstat(fd, &sb) != 0 || !S_ISREG(sb.st_mode)) {
|
||||
free(path);
|
||||
close(fd);
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: tktfile %s is not a file",
|
||||
path);
|
||||
free(path);
|
||||
close(fd);
|
||||
return KRB5_FCC_PERM;
|
||||
}
|
||||
|
||||
@@ -178,11 +179,11 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
break;
|
||||
}
|
||||
if (i == KRB5_TF_LCK_RETRY_COUNT) {
|
||||
free(path);
|
||||
close(fd);
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: failed to lock %s",
|
||||
path);
|
||||
free(path);
|
||||
close(fd);
|
||||
return KRB5_FCC_PERM;
|
||||
}
|
||||
|
||||
@@ -190,11 +191,11 @@ write_v4_cc(krb5_context context, const char *tkfile,
|
||||
ret = ftruncate(fd, 0);
|
||||
if (ret < 0) {
|
||||
flock(fd, LOCK_UN);
|
||||
free(path);
|
||||
close(fd);
|
||||
krb5_set_error_string(context,
|
||||
"krb5_krb_tf_setup: failed to truncate %s",
|
||||
path);
|
||||
free(path);
|
||||
close(fd);
|
||||
return KRB5_FCC_PERM;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user