2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Use ecalloc() when allocating structs.

This commit is contained in:
Todd C. Miller
2012-03-19 11:24:24 -04:00
parent dbbb48c45f
commit 55d1a1a79d
15 changed files with 81 additions and 94 deletions

View File

@@ -1984,14 +1984,7 @@ sudo_ldap_result_alloc(void)
struct ldap_result *result;
debug_decl(sudo_ldap_result_alloc, SUDO_DEBUG_LDAP)
result = emalloc(sizeof(*result));
result->searches = NULL;
result->nentries = 0;
result->entries = NULL;
result->allocated_entries = 0;
result->user_matches = false;
result->host_matches = false;
debug_return_ptr(result);
debug_return_ptr(ecalloc(1, sizeof(*result)));
}
/*
@@ -2030,10 +2023,10 @@ sudo_ldap_result_add_search(struct ldap_result *lres, LDAP *ldap,
struct ldap_search_list *s, *news;
debug_decl(sudo_ldap_result_add_search, SUDO_DEBUG_LDAP)
news = emalloc(sizeof(struct ldap_search_list));
news->next = NULL;
news = ecalloc(1, sizeof(struct ldap_search_list));
news->ldap = ldap;
news->searchresult = searchresult;
/* news->next = NULL; */
/* Add entry to the end of the chain (XXX - tailq instead?). */
if (lres->searches) {
@@ -2200,11 +2193,11 @@ sudo_ldap_open(struct sudo_nss *nss)
debug_return_int(-1);
/* Create a handle container. */
handle = emalloc(sizeof(struct sudo_ldap_handle));
handle = ecalloc(1, sizeof(struct sudo_ldap_handle));
handle->ld = ld;
handle->result = NULL;
handle->username = NULL;
handle->grlist = NULL;
/* handle->result = NULL; */
/* handle->username = NULL; */
/* handle->grlist = NULL; */
nss->handle = handle;
debug_return_int(0);