(get_cell_and_realm): reset d->cell to make sure its not refereced
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17213 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -63,8 +63,7 @@ struct akf_data {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_cell_and_realm (krb5_context context,
|
get_cell_and_realm (krb5_context context, struct akf_data *d)
|
||||||
struct akf_data *d)
|
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[BUFSIZ], *cp;
|
char buf[BUFSIZ], *cp;
|
||||||
@@ -95,6 +94,7 @@ get_cell_and_realm (krb5_context context,
|
|||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
if (fgets (buf, sizeof(buf), f) == NULL) {
|
if (fgets (buf, sizeof(buf), f) == NULL) {
|
||||||
free (d->cell);
|
free (d->cell);
|
||||||
|
d->cell = NULL;
|
||||||
fclose (f);
|
fclose (f);
|
||||||
krb5_set_error_string (context, "no realm in %s",
|
krb5_set_error_string (context, "no realm in %s",
|
||||||
AFS_SERVERMAGICKRBCONF);
|
AFS_SERVERMAGICKRBCONF);
|
||||||
@@ -110,6 +110,7 @@ get_cell_and_realm (krb5_context context,
|
|||||||
d->realm = strdup (buf);
|
d->realm = strdup (buf);
|
||||||
if (d->realm == NULL) {
|
if (d->realm == NULL) {
|
||||||
free (d->cell);
|
free (d->cell);
|
||||||
|
d->cell = NULL;
|
||||||
krb5_set_error_string (context, "malloc: out of memory");
|
krb5_set_error_string (context, "malloc: out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user