Bug 1376638 - Minimize uses of prmem.h. r=glandium.
It's silly to use prmem.h within Firefox code given that in our configuration its functions are just wrappers for malloc() et al. (Indeed, in some places we mix PR_Malloc() with free(), or malloc() with PR_Free().) This patch removes all uses, except for the places where we need to use PR_Free() to free something allocated by another NSPR function; in those cases I've added a comment explaining which function did the allocation.
This commit is contained in:
@@ -1908,7 +1908,7 @@ nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistentDescriptor)
|
||||
AliasRecord aliasHeader = *(AliasPtr)decodedData;
|
||||
int32_t aliasSize = ::GetAliasSizeFromPtr(&aliasHeader);
|
||||
if (aliasSize > ((int32_t)dataSize * 3) / 4) { // be paranoid about having too few data
|
||||
PR_Free(decodedData);
|
||||
PR_Free(decodedData); // PL_Base64Decode() uses PR_Malloc().
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1920,7 +1920,7 @@ nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistentDescriptor)
|
||||
if (::PtrToHand(decodedData, &newHandle, aliasSize) != noErr) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
PR_Free(decodedData);
|
||||
PR_Free(decodedData); // PL_Base64Decode() uses PR_Malloc().
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user