Fix deref before NULL check, fix error handling.

Coverity, NetBSD CID#2369


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17037 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-04-10 09:33:15 +00:00
parent 494ca3d6a8
commit 7b91fa46c7

View File

@@ -139,6 +139,11 @@ krb4_kt_start_seq_get_int (krb5_context context,
return ret;
}
c->sp = krb5_storage_from_fd(c->fd);
if(sp == NULL) {
close(c->fd);
free(ed);
return ENOMEM;
}
krb5_storage_set_eof_code(c->sp, KRB5_KT_END);
return 0;
}
@@ -302,11 +307,11 @@ krb4_kt_add_entry (krb5_context context,
}
}
sp = krb5_storage_from_fd(fd);
krb5_storage_set_eof_code(sp, KRB5_KT_END);
if(sp == NULL) {
close(fd);
return ENOMEM;
}
krb5_storage_set_eof_code(sp, KRB5_KT_END);
ret = krb4_store_keytab_entry(context, entry, sp);
krb5_storage_free(sp);
if(close (fd) < 0)