(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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user