Commit 36b92e1d authored by John van Groningen's avatar John van Groningen
Browse files

fix bug in the memory allocator

parent 0469f825
......@@ -142,19 +142,15 @@ AllocConvertBuffer (int min_size)
{
ConvertBufferP newBuffer;
int new_convert_buffer_size;
new_convert_buffer_size=sizeof (ConvertBufferS);
while (min_size>new_convert_buffer_size)
new_convert_buffer_size=kDefaultConvertBufferSize;
while (new_convert_buffer_size<min_size)
new_convert_buffer_size+=kDefaultConvertBufferSize;
newBuffer = (ConvertBufferP) malloc (new_convert_buffer_size);
newBuffer = (ConvertBufferP) malloc (sizeof (ConvertBufferS)+(new_convert_buffer_size-kDefaultConvertBufferSize));
if (newBuffer == NULL)
FatalCompError ("backendsupport.c", "AllocConvertBuffer", "out of memory");
new_convert_buffer_size -= sizeof (ConvertBufferS)-kDefaultConvertBufferSize;
newBuffer->cb_size=new_convert_buffer_size;
if (gFirstBuffer == NULL)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment