1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

Added some bulletproofing to memory allocation in the LDAP cache

code.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Graham Leggett
2001-08-30 00:46:25 +00:00
parent 5eb009b6be
commit f94ab6fedd
4 changed files with 50 additions and 17 deletions

View File

@@ -90,11 +90,19 @@ void *util_ldap_url_node_copy(void *c)
util_url_node_t *n = (util_url_node_t *)c;
util_url_node_t *node = (util_url_node_t *)util_ald_alloc(sizeof(util_url_node_t));
node->url = util_ald_strdup(n->url);
node->search_cache = n->search_cache;
node->compare_cache = n->compare_cache;
node->dn_compare_cache = n->dn_compare_cache;
return node;
if (node) {
if (!(node->url = util_ald_strdup(n->url))) {
util_ald_free(node->url);
return NULL;
}
node->search_cache = n->search_cache;
node->compare_cache = n->compare_cache;
node->dn_compare_cache = n->dn_compare_cache;
return node;
}
else {
return NULL;
}
}
void util_ldap_url_node_free(void *n)
@@ -200,12 +208,21 @@ void *util_ldap_compare_node_copy(void *c)
{
util_compare_node_t *n = (util_compare_node_t *)c;
util_compare_node_t *node = (util_compare_node_t *)util_ald_alloc(sizeof(util_compare_node_t));
node->dn = util_ald_strdup(n->dn);
node->attrib = util_ald_strdup(n->attrib);
node->value = util_ald_strdup(n->value);
node->lastcompare = n->lastcompare;
node->result = n->result;
return node;
if (node) {
if (!(node->dn = util_ald_strdup(n->dn)) ||
!(node->attrib = util_ald_strdup(n->attrib)) ||
!(node->value = util_ald_strdup(n->value))) {
util_ldap_compare_node_free(node);
return NULL;
}
node->lastcompare = n->lastcompare;
node->result = n->result;
return node;
}
else {
return NULL;
}
}
void util_ldap_compare_node_free(void *n)
@@ -234,9 +251,17 @@ void *util_ldap_dn_compare_node_copy(void *c)
{
util_dn_compare_node_t *n = (util_dn_compare_node_t *)c;
util_dn_compare_node_t *node = (util_dn_compare_node_t *)util_ald_alloc(sizeof(util_dn_compare_node_t));
node->reqdn = util_ald_strdup(n->reqdn);
node->dn = util_ald_strdup(n->dn);
return node;
if (node) {
if (!(node->reqdn = util_ald_strdup(n->reqdn)) ||
!(node->dn = util_ald_strdup(n->dn))) {
util_ldap_dn_compare_node_free(node);
return NULL;
}
return node;
}
else {
return NULL;
}
}
void util_ldap_dn_compare_node_free(void *n)