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:
@@ -128,8 +128,10 @@ void util_ald_free(const void *ptr)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *util_ald_alloc(int size)
|
||||
void *util_ald_alloc(unsigned long size)
|
||||
{
|
||||
if (0 == size)
|
||||
return NULL;
|
||||
#if APR_HAS_SHARED_MEMORY
|
||||
if (util_ldap_shm) {
|
||||
return (void *)apr_shm_calloc(util_ldap_shm, size);
|
||||
@@ -137,7 +139,7 @@ void *util_ald_alloc(int size)
|
||||
return (void *)calloc(sizeof(char), size);
|
||||
}
|
||||
#else
|
||||
return (void *)calloc(size);
|
||||
return (void *)calloc(sizeof(char), size);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -202,6 +204,9 @@ void util_ald_cache_purge(util_ald_cache_t *cache)
|
||||
int i;
|
||||
util_cache_node_t *p, *q;
|
||||
apr_time_t t;
|
||||
|
||||
if (!cache)
|
||||
return;
|
||||
|
||||
cache->last_purge = apr_time_now();
|
||||
cache->npurged = 0;
|
||||
|
Reference in New Issue
Block a user