(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:
15
kdc/misc.c
15
kdc/misc.c
@@ -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).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -43,7 +43,10 @@ db_fetch(krb5_principal principal)
|
|||||||
hdb_entry *ent;
|
hdb_entry *ent;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
int i;
|
int i;
|
||||||
ALLOC(ent);
|
|
||||||
|
ent = malloc (sizeof (*ent));
|
||||||
|
if (ent == NULL)
|
||||||
|
return NULL;
|
||||||
ent->principal = principal;
|
ent->principal = principal;
|
||||||
|
|
||||||
for(i = 0; i < num_db; i++) {
|
for(i = 0; i < num_db; i++) {
|
||||||
@@ -61,3 +64,11 @@ db_fetch(krb5_principal principal)
|
|||||||
free(ent);
|
free(ent);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_ent(hdb_entry *ent)
|
||||||
|
{
|
||||||
|
hdb_free_entry (context, ent);
|
||||||
|
free (ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user