(db_fetch): check malloc

(free_ent): new function


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9030 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-09-10 14:13:51 +00:00
parent e97f681ee5
commit 2032126e34

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -43,7 +43,10 @@ db_fetch(krb5_principal principal)
hdb_entry *ent;
krb5_error_code ret;
int i;
ALLOC(ent);
ent = malloc (sizeof (*ent));
if (ent == NULL)
return NULL;
ent->principal = principal;
for(i = 0; i < num_db; i++) {
@@ -61,3 +64,11 @@ db_fetch(krb5_principal principal)
free(ent);
return NULL;
}
void
free_ent(hdb_entry *ent)
{
hdb_free_entry (context, ent);
free (ent);
}