(krb5_storage_from_fd): don't leak fd on malloc failure

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17779 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-06-30 21:23:19 +00:00
parent 9b1216b13c
commit 0af8ebf043

View File

@@ -74,13 +74,16 @@ krb5_storage_from_fd(int fd)
fd = dup(fd);
if (fd < 0)
return NULL;
sp = malloc(sizeof(krb5_storage));
if (sp == NULL)
sp = malloc(sizeof(krb5_storage));
if (sp == NULL) {
close(fd);
return NULL;
}
sp->data = malloc(sizeof(fd_storage));
if (sp->data == NULL) {
close(fd);
free(sp);
return NULL;
}