Hi,

While experimenting with memory managers, I noticed that IconvLCPTranscoder::transcode() passes a NULL pointer occasionally to MemoryManager::deallocate(). This is for version 2.8. It looks like when transcoding small strings it uses a stack allocated buffer as the target, and dynamically allocates through the memory manager when it's larger:

if (maxChars >= gTempBuffArraySize)
        wideCharBuf = allocatedArray = (wchar_t*) manager->allocate
        (
            (maxChars + 1) * sizeof(wchar_t)
        );//new wchar_t[maxChars + 1];
    else
        wideCharBuf = tmpWideCharArr;

But it unconditionally calls 'manager->deallocate(allocatedArray)' at the end of the function. I'm guessing it would be best to deallocate it only if it's non-NULL since some runtime's might complain passing a NULL into ::delete().

Thanks,
Jerry


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to