On 8/1/14, 12:28 PM, Piotr Caban wrote:
On 8/1/14 12:01 PM, Aric Stewart wrote:
- if (i == This->CollectionLoaderCount)
- {
This->CollectionLoaderCount++;
if (This->CollectionLoaders)
This->CollectionLoaders = heap_realloc(This->CollectionLoaders, This->CollectionLoaderCount * sizeof(IDWriteFontCollectionLoader*));
else
This->CollectionLoaders = heap_alloc(This->CollectionLoaderCount * sizeof(IDWriteFontCollectionLoader*));
if (!This->CollectionLoaders)
return E_OUTOFMEMORY;
- }
There's a leak in out of memory case. Isn't it better to grow the buffer exponentially?
I do not think a given application will be registering very many of these. No experience yet but I would be surprised at more than 2. So I am not sure if exponential is the right course. But it is an easy change.
Maybe i have been spending too much time out of C recently, but I am totally failing to see the leak. Other than the face that our loader object will be in a corrupt state, I can fix the corrupt state but I am not sure if that would be fixing the memory leak you see.
-aric