wasn't tracked and used for the realloc, so it tended to explode.
* There are some bytes of extra data before \c array_info_cache that is
* used to hold the header for RenderLarge commands. This is
* \b not included in \c array_info_cache_size or
- * \c array_info_cache_buffer_size.
+ * \c array_info_cache_buffer_size. \c array_info_cache_base stores a
+ * pointer to the true start of the buffer (i.e., what malloc returned).
*/
/*@{*/
size_t array_info_cache_size;
size_t array_info_cache_buffer_size;
void * array_info_cache;
+ void * array_info_cache_base;
/*@}*/
{
#define MAX_HEADER_SIZE 20
if ( arrays->array_info_cache_buffer_size < required_size ) {
- GLubyte * temp = realloc( arrays->array_info_cache, required_size
- + MAX_HEADER_SIZE );
+ GLubyte * temp = realloc( arrays->array_info_cache_base,
+ required_size + MAX_HEADER_SIZE );
if ( temp == NULL ) {
return GL_FALSE;
}
+ arrays->array_info_cache_base = temp;
arrays->array_info_cache = temp + MAX_HEADER_SIZE;
arrays->array_info_cache_buffer_size = required_size;
}