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:
@@ -139,6 +139,11 @@ krb4_kt_start_seq_get_int (krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
c->sp = krb5_storage_from_fd(c->fd);
|
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);
|
krb5_storage_set_eof_code(c->sp, KRB5_KT_END);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -302,11 +307,11 @@ krb4_kt_add_entry (krb5_context context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
krb5_storage_set_eof_code(sp, KRB5_KT_END);
|
|
||||||
if(sp == NULL) {
|
if(sp == NULL) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
krb5_storage_set_eof_code(sp, KRB5_KT_END);
|
||||||
ret = krb4_store_keytab_entry(context, entry, sp);
|
ret = krb4_store_keytab_entry(context, entry, sp);
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
if(close (fd) < 0)
|
if(close (fd) < 0)
|
||||||
|
Reference in New Issue
Block a user