(krb5_storage_from_fd): check malloc returns
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10190 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -63,7 +63,15 @@ krb5_storage *
|
|||||||
krb5_storage_from_fd(int fd)
|
krb5_storage_from_fd(int fd)
|
||||||
{
|
{
|
||||||
krb5_storage *sp = malloc(sizeof(krb5_storage));
|
krb5_storage *sp = malloc(sizeof(krb5_storage));
|
||||||
|
|
||||||
|
if (sp == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
sp->data = malloc(sizeof(fd_storage));
|
sp->data = malloc(sizeof(fd_storage));
|
||||||
|
if (sp->data == NULL) {
|
||||||
|
free(sp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
sp->flags = 0;
|
sp->flags = 0;
|
||||||
FD(sp) = fd;
|
FD(sp) = fd;
|
||||||
sp->fetch = fd_fetch;
|
sp->fetch = fd_fetch;
|
||||||
|
Reference in New Issue
Block a user