[Webkit-unassigned] [Bug 96272] NPN_InitializeVariantWithStringCopy is wrong for platforms that return NULL from malloc(0)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 23 16:33:46 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=96272





--- Comment #17 from Alexey Proskuryakov <ap at webkit.org>  2013-01-23 16:35:40 PST ---
Oh, interesting. So plug-ins can get their own data into a variant with STRINGZ_TO_NPVARIANT. The contract is that they use NPN_MemAlloc, but we don't really want to rely on that, as a comment in npnMemAlloc explains:

void* npnMemAlloc(uint32_t size)
{
    // We could use fastMalloc here, but there might be plug-ins that mix NPN_MemAlloc/NPN_MemFree with malloc and free,
    // so having them be equivalent seems like a good idea.
    return malloc(size);
}

This means that it's undesirable to switch NPN_InitializeVariantWithStringCopy to fastMalloc indeed. But we also need a comment explaining this, so that the next time someone looks at this code, they could find the explanation more easily.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list