diff --git a/dom/base/BlobSet.h b/dom/base/BlobSet.h index 198e80850b43..dc021362e267 100644 --- a/dom/base/BlobSet.h +++ b/dom/base/BlobSet.h @@ -20,7 +20,7 @@ public: ~BlobSet() { - moz_free(mData); + free(mData); } nsresult AppendVoidPtr(const void* aData, uint32_t aLength); @@ -52,7 +52,7 @@ protected: if (!bufferLen.isValid()) return false; - void* data = moz_realloc(mData, bufferLen.value()); + void* data = realloc(mData, bufferLen.value()); if (!data) return false; diff --git a/dom/base/File.h b/dom/base/File.h index ad704a007c20..b3fae54be4ed 100644 --- a/dom/base/File.h +++ b/dom/base/File.h @@ -84,7 +84,7 @@ public: uint64_t aLength); // The returned File takes ownership of aMemoryBuffer. aMemoryBuffer will be - // freed by moz_free so it must be allocated by moz_malloc or something + // freed by free so it must be allocated by malloc or something // compatible with it. static already_AddRefed CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength, @@ -92,7 +92,7 @@ public: uint64_t aLastModifiedDate); // The returned File takes ownership of aMemoryBuffer. aMemoryBuffer will be - // freed by moz_free so it must be allocated by moz_malloc or something + // freed by free so it must be allocated by malloc or something // compatible with it. static already_AddRefed CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength, @@ -552,7 +552,7 @@ public: sDataOwners = nullptr; } - moz_free(mData); + free(mData); } public: diff --git a/dom/base/nsAttrAndChildArray.cpp b/dom/base/nsAttrAndChildArray.cpp index 6ebc62e751f3..a3ed01bb97a7 100644 --- a/dom/base/nsAttrAndChildArray.cpp +++ b/dom/base/nsAttrAndChildArray.cpp @@ -102,7 +102,7 @@ nsAttrAndChildArray::~nsAttrAndChildArray() Clear(); - moz_free(mImpl); + free(mImpl); } nsIContent* @@ -635,11 +635,11 @@ nsAttrAndChildArray::Compact() // Then resize or free buffer uint32_t newSize = attrCount * ATTRSIZE + childCount; if (!newSize && !mImpl->mMappedAttrs) { - moz_free(mImpl); + free(mImpl); mImpl = nullptr; } else if (newSize < mImpl->mBufferSize) { - mImpl = static_cast(moz_realloc(mImpl, (newSize + NS_IMPL_EXTRA_SIZE) * sizeof(nsIContent*))); + mImpl = static_cast(realloc(mImpl, (newSize + NS_IMPL_EXTRA_SIZE) * sizeof(nsIContent*))); NS_ASSERTION(mImpl, "failed to reallocate to smaller buffer"); mImpl->mBufferSize = newSize; @@ -776,7 +776,7 @@ nsAttrAndChildArray::GrowBy(uint32_t aGrowSize) } bool needToInitialize = !mImpl; - Impl* newImpl = static_cast(moz_realloc(mImpl, size * sizeof(void*))); + Impl* newImpl = static_cast(realloc(mImpl, size * sizeof(void*))); NS_ENSURE_TRUE(newImpl, false); mImpl = newImpl; diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 6604b747ea64..0d8edff1eed6 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -6052,7 +6052,7 @@ nsContentUtils::CreateBlobBuffer(JSContext* aCx, JS::MutableHandle aBlob) { uint32_t blobLen = aData.Length(); - void* blobData = moz_malloc(blobLen); + void* blobData = malloc(blobLen); nsRefPtr blob; if (blobData) { memcpy(blobData, aData.BeginReading(), blobLen); diff --git a/dom/base/nsDOMFileReader.cpp b/dom/base/nsDOMFileReader.cpp index 6dda3a1edc1b..062856273da4 100644 --- a/dom/base/nsDOMFileReader.cpp +++ b/dom/base/nsDOMFileReader.cpp @@ -363,7 +363,7 @@ nsDOMFileReader::DoReadData(nsIAsyncInputStream* aStream, uint64_t aCount) return NS_ERROR_OUT_OF_MEMORY; } if (mDataFormat != FILE_AS_ARRAYBUFFER) { - mFileData = (char *) moz_realloc(mFileData, mDataLen + aCount); + mFileData = (char *) realloc(mFileData, mDataLen + aCount); NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY); } diff --git a/dom/base/nsDOMFileReader.h b/dom/base/nsDOMFileReader.h index 92fb59e50388..a7cd81e9093f 100644 --- a/dom/base/nsDOMFileReader.h +++ b/dom/base/nsDOMFileReader.h @@ -131,7 +131,7 @@ protected: nsresult GetAsDataURL(nsIDOMBlob *aFile, const char *aFileData, uint32_t aDataLen, nsAString &aResult); void FreeFileData() { - moz_free(mFileData); + free(mFileData); mFileData = nullptr; mDataLen = 0; } diff --git a/dom/base/nsScriptLoader.cpp b/dom/base/nsScriptLoader.cpp index 6b6e55997d61..bc442e3623e6 100644 --- a/dom/base/nsScriptLoader.cpp +++ b/dom/base/nsScriptLoader.cpp @@ -1461,7 +1461,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, } rv = NS_OK; } else { - moz_free(const_cast(aString)); + free(const_cast(aString)); rv = NS_SUCCESS_ADOPTED_DATA; } diff --git a/dom/base/nsTextFragment.cpp b/dom/base/nsTextFragment.cpp index f39d680de342..3367e6010f6e 100644 --- a/dom/base/nsTextFragment.cpp +++ b/dom/base/nsTextFragment.cpp @@ -84,7 +84,7 @@ void nsTextFragment::ReleaseText() { if (mState.mLength && m1b && mState.mInHeap) { - moz_free(m2b); // m1b == m2b as far as moz_free is concerned + free(m2b); // m1b == m2b as far as free is concerned } m1b = nullptr; @@ -107,7 +107,7 @@ nsTextFragment::operator=(const nsTextFragment& aOther) size_t m2bSize = aOther.mState.mLength * (aOther.mState.mIs2b ? sizeof(char16_t) : sizeof(char)); - m2b = static_cast(moz_malloc(m2bSize)); + m2b = static_cast(malloc(m2bSize)); if (m2b) { memcpy(m2b, aOther.m2b, m2bSize); } else { @@ -255,7 +255,7 @@ nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi if (first16bit != -1) { // aBuffer contains no non-8bit character // Use ucs2 storage because we have to size_t m2bSize = aLength * sizeof(char16_t); - m2b = (char16_t *)moz_malloc(m2bSize); + m2b = (char16_t *)malloc(m2bSize); if (!m2b) { return false; } @@ -268,7 +268,7 @@ nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi } else { // Use 1 byte storage because we can - char* buff = (char *)moz_malloc(aLength * sizeof(char)); + char* buff = (char *)malloc(aLength * sizeof(char)); if (!buff) { return false; } @@ -326,7 +326,7 @@ nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBi if (mState.mIs2b) { // Already a 2-byte string so the result will be too - char16_t* buff = (char16_t*)moz_realloc(m2b, (mState.mLength + aLength) * sizeof(char16_t)); + char16_t* buff = (char16_t*)realloc(m2b, (mState.mLength + aLength) * sizeof(char16_t)); if (!buff) { return false; } @@ -348,8 +348,8 @@ nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBi if (first16bit != -1) { // aBuffer contains no non-8bit character // The old data was 1-byte, but the new is not so we have to expand it // all to 2-byte - char16_t* buff = (char16_t*)moz_malloc((mState.mLength + aLength) * - sizeof(char16_t)); + char16_t* buff = + (char16_t*)malloc((mState.mLength + aLength) * sizeof(char16_t)); if (!buff) { return false; } @@ -363,7 +363,7 @@ nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBi mState.mIs2b = true; if (mState.mInHeap) { - moz_free(m2b); + free(m2b); } m2b = buff; @@ -379,14 +379,14 @@ nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBi // The new and the old data is all 1-byte char* buff; if (mState.mInHeap) { - buff = (char*)moz_realloc(const_cast(m1b), - (mState.mLength + aLength) * sizeof(char)); + buff = (char*)realloc(const_cast(m1b), + (mState.mLength + aLength) * sizeof(char)); if (!buff) { return false; } } else { - buff = (char*)moz_malloc((mState.mLength + aLength) * sizeof(char)); + buff = (char*)malloc((mState.mLength + aLength) * sizeof(char)); if (!buff) { return false; } diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index 4a2d33e81b87..52a8e51aca65 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -174,7 +174,7 @@ WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) if (!boundBuffer) return ErrorInvalidOperation("bufferData: no buffer bound!"); - UniquePtr zeroBuffer((uint8_t*)moz_calloc(size, 1)); + UniquePtr zeroBuffer((uint8_t*)calloc(size, 1)); if (!zeroBuffer) return ErrorOutOfMemory("bufferData: out of memory"); diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 4a11c32e1b16..bad7918727de 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -674,7 +674,7 @@ public: ~AutoFreeBuffer() { - moz_free(mBuffer); + free(mBuffer); } void diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index ea2fb3a1fcfa..597971959a77 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -14785,14 +14785,14 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(TransactionBase* aTransaction) reinterpret_cast(mParams.cloneInfo().data().Elements()); size_t uncompressedLength = mParams.cloneInfo().data().Length(); - // We don't have a smart pointer class that calls moz_free, so we need to + // We don't have a smart pointer class that calls free, so we need to // manage | compressed | manually. { size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength); - // moz_malloc is equivalent to NS_Alloc, which we use because mozStorage + // malloc is equivalent to NS_Alloc, which we use because mozStorage // expects to be able to free the adopted pointer with NS_Free. - char* compressed = static_cast(moz_malloc(compressedLength)); + char* compressed = static_cast(malloc(compressedLength)); if (NS_WARN_IF(!compressed)) { return NS_ERROR_OUT_OF_MEMORY; } @@ -14808,7 +14808,7 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(TransactionBase* aTransaction) rv = stmt->BindAdoptedBlobByName(NS_LITERAL_CSTRING("data"), dataBuffer, dataBufferLength); if (NS_WARN_IF(NS_FAILED(rv))) { - moz_free(compressed); + free(compressed); return rv; } } diff --git a/dom/ipc/Blob.cpp b/dom/ipc/Blob.cpp index 7dc612750aed..0549fcff1df0 100644 --- a/dom/ipc/Blob.cpp +++ b/dom/ipc/Blob.cpp @@ -836,7 +836,7 @@ CreateBlobImpl(const nsTArray& aMemoryData, return nullptr; } - void* buffer = moz_malloc(length * elementSizeMultiplier); + void* buffer = malloc(length * elementSizeMultiplier); if (NS_WARN_IF(!buffer)) { return nullptr; } diff --git a/dom/media/EncodedBufferCache.cpp b/dom/media/EncodedBufferCache.cpp index ddb927c8f53b..283e5ef2bfa5 100644 --- a/dom/media/EncodedBufferCache.cpp +++ b/dom/media/EncodedBufferCache.cpp @@ -54,7 +54,7 @@ EncodedBufferCache::ExtractBlob(nsISupports* aParent, mDataSize = 0; mFD = nullptr; } else { - void* blobData = moz_malloc(mDataSize); + void* blobData = malloc(mDataSize); NS_ASSERTION(blobData, "out of memory!!"); if (blobData) { diff --git a/dom/media/webaudio/AnalyserNode.cpp b/dom/media/webaudio/AnalyserNode.cpp index d6adbcfcf809..69a94afae8e1 100644 --- a/dom/media/webaudio/AnalyserNode.cpp +++ b/dom/media/webaudio/AnalyserNode.cpp @@ -255,7 +255,7 @@ AnalyserNode::FFTAnalysis() if (mWriteIndex == 0) { inputBuffer = mBuffer.Elements(); } else { - inputBuffer = static_cast(moz_malloc(FftSize() * sizeof(float))); + inputBuffer = static_cast(malloc(FftSize() * sizeof(float))); if (!inputBuffer) { return false; } @@ -280,7 +280,7 @@ AnalyserNode::FFTAnalysis() } if (allocated) { - moz_free(inputBuffer); + free(inputBuffer); } return true; } diff --git a/dom/media/webrtc/AudioOutputObserver.h b/dom/media/webrtc/AudioOutputObserver.h index 13574c4efc7b..4034a5a2729a 100644 --- a/dom/media/webrtc/AudioOutputObserver.h +++ b/dom/media/webrtc/AudioOutputObserver.h @@ -52,7 +52,7 @@ private: uint32_t mChunkSize; // chunking to 10ms support - FarEndAudioChunk *mSaved; // can't be nsAutoPtr since we need to use moz_free() + FarEndAudioChunk *mSaved; // can't be nsAutoPtr since we need to use free(), not delete uint32_t mSamplesSaved; }; diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 54c60ea407b1..57aa57e8a83f 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -603,7 +603,7 @@ MediaEngineGonkVideoSource::OnTakePictureComplete(uint8_t* aData, uint32_t aLeng : mPhotoDataLength(aLength) { mCallbacks.SwapElements(aCallbacks); - mPhotoData = (uint8_t*) moz_malloc(aLength); + mPhotoData = (uint8_t*) malloc(aLength); memcpy(mPhotoData, aData, mPhotoDataLength); mMimeType = aMimeType; } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 8342f355374e..4ef7738e72aa 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -67,7 +67,7 @@ AudioOutputObserver::AudioOutputObserver() AudioOutputObserver::~AudioOutputObserver() { Clear(); - moz_free(mSaved); + free(mSaved); mSaved = nullptr; } @@ -75,7 +75,7 @@ void AudioOutputObserver::Clear() { while (mPlayoutFifo->size() > 0) { - moz_free(mPlayoutFifo->Pop()); + free(mPlayoutFifo->Pop()); } // we'd like to touch mSaved here, but we can't if we might still be getting callbacks } @@ -544,7 +544,7 @@ MediaEngineWebRTCAudioSource::Process(int channel, if (!mStarted) { mStarted = true; while (gFarendObserver->Size() > 1) { - moz_free(gFarendObserver->Pop()); // only call if size() > 0 + free(gFarendObserver->Pop()); // only call if size() > 0 } } @@ -557,7 +557,7 @@ MediaEngineWebRTCAudioSource::Process(int channel, gFarendObserver->PlayoutChannels(), mPlayoutDelay, length); - moz_free(buffer); + free(buffer); if (res == -1) { return; } diff --git a/dom/plugins/ipc/PluginInterposeOSX.mm b/dom/plugins/ipc/PluginInterposeOSX.mm index 39b99232d80d..7271181e35bb 100644 --- a/dom/plugins/ipc/PluginInterposeOSX.mm +++ b/dom/plugins/ipc/PluginInterposeOSX.mm @@ -265,13 +265,13 @@ NSCursorInfo::NSCursorInfo(const Cursor* aCursor) } } - moz_free(bitmap); + free(bitmap); } NSCursorInfo::~NSCursorInfo() { if (mCustomImageData) { - moz_free(mCustomImageData); + free(mCustomImageData); } } @@ -438,7 +438,7 @@ NSCursor* NSCursorInfo::GetTransparentCursor() const } } - moz_free(data); + free(data); // Fall back to an arrow cursor if (for some reason) the above code failed. if (!retval) { @@ -528,7 +528,7 @@ void NSCursorInfo::SetHotSpot(nsPoint aHotSpot) void NSCursorInfo::SetCustomImageData(uint8_t* aData, uint32_t aDataLength) { if (mCustomImageData) { - moz_free(mCustomImageData); + free(mCustomImageData); } if (aDataLength) { mCustomImageData = (uint8_t*) moz_xmalloc(aDataLength); diff --git a/dom/xul/nsXULContentSink.cpp b/dom/xul/nsXULContentSink.cpp index 3b05965fa0e0..bbb1c279eef6 100644 --- a/dom/xul/nsXULContentSink.cpp +++ b/dom/xul/nsXULContentSink.cpp @@ -184,7 +184,7 @@ XULContentSinkImpl::~XULContentSinkImpl() NS_ASSERTION(mContextStack.Depth() == 0, "Context stack not empty?"); mContextStack.Clear(); - moz_free(mText); + free(mText); } //---------------------------------------------------------------------- @@ -1051,7 +1051,7 @@ XULContentSinkImpl::AddText(const char16_t* aText, { // Create buffer when we first need it if (0 == mTextSize) { - mText = (char16_t *) moz_malloc(sizeof(char16_t) * 4096); + mText = (char16_t *) malloc(sizeof(char16_t) * 4096); if (nullptr == mText) { return NS_ERROR_OUT_OF_MEMORY; } @@ -1074,7 +1074,7 @@ XULContentSinkImpl::AddText(const char16_t* aText, } else { mTextSize += aLength; - mText = (char16_t *) moz_realloc(mText, sizeof(char16_t) * mTextSize); + mText = (char16_t *) realloc(mText, sizeof(char16_t) * mTextSize); if (nullptr == mText) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/gfx/2d/Tools.h b/gfx/2d/Tools.h index d7405c75bce6..40e4de2272e4 100644 --- a/gfx/2d/Tools.h +++ b/gfx/2d/Tools.h @@ -134,14 +134,14 @@ struct AlignedArray } #endif - moz_free(mStorage); + free(mStorage); mStorage = nullptr; mPtr = nullptr; } MOZ_ALWAYS_INLINE void Realloc(size_t aCount, bool aZero = false) { - moz_free(mStorage); + free(mStorage); CheckedInt32 storageByteCount = CheckedInt32(sizeof(T)) * aCount + (alignment - 1); if (!storageByteCount.isValid()) { @@ -155,9 +155,9 @@ struct AlignedArray if (aZero) { // calloc can be more efficient than new[] for large chunks, // so we use calloc/malloc/free for everything. - mStorage = static_cast(moz_calloc(1, storageByteCount.value())); + mStorage = static_cast(calloc(1, storageByteCount.value())); } else { - mStorage = static_cast(moz_malloc(storageByteCount.value())); + mStorage = static_cast(malloc(storageByteCount.value())); } if (!mStorage) { mStorage = nullptr; diff --git a/gfx/graphite2/src/MozGrMalloc.h b/gfx/graphite2/src/MozGrMalloc.h index 73e5c674f64a..acaae1236c49 100644 --- a/gfx/graphite2/src/MozGrMalloc.h +++ b/gfx/graphite2/src/MozGrMalloc.h @@ -6,7 +6,7 @@ #ifndef MOZ_GR_MALLOC_H #define MOZ_GR_MALLOC_H -// Override malloc() and friends to call moz_malloc() etc, so that we get +// Override malloc() and friends to call moz_xmalloc() etc, so that we get // predictable, safe OOM crashes rather than relying on the code to handle // allocation failures reliably. @@ -15,6 +15,5 @@ #define malloc moz_xmalloc #define calloc moz_xcalloc #define realloc moz_xrealloc -#define free moz_free #endif // MOZ_GR_MALLOC_H diff --git a/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch b/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch index 76ae1131fb41..719fda16506f 100644 --- a/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch +++ b/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch @@ -64,10 +64,10 @@ index 0000000..1f16ee5 +} + +void sk_free(void* p) { -+ moz_free(p); ++ free(p); +} + +void* sk_malloc_flags(size_t size, unsigned flags) { -+ return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size); ++ return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size); +} + diff --git a/gfx/skia/trunk/src/ports/SkMemory_mozalloc.cpp b/gfx/skia/trunk/src/ports/SkMemory_mozalloc.cpp index 4ca931267152..f07008589381 100644 --- a/gfx/skia/trunk/src/ports/SkMemory_mozalloc.cpp +++ b/gfx/skia/trunk/src/ports/SkMemory_mozalloc.cpp @@ -31,15 +31,15 @@ void* sk_realloc_throw(void* addr, size_t size) { } void sk_free(void* p) { - moz_free(p); + free(p); } void* sk_malloc_flags(size_t size, unsigned flags) { - return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size); + return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size); } void* sk_calloc(size_t size) { - return moz_calloc(size, 1); + return calloc(size, 1); } void* sk_calloc_throw(size_t size) { diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 671813b3d6d6..f0dbe3ec1599 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -107,7 +107,7 @@ public: NS_ASSERTION(item, "failed to find zip entry"); uint32_t bufSize = item->RealSize(); - mFontDataBuf = static_cast(moz_malloc(bufSize)); + mFontDataBuf = static_cast(malloc(bufSize)); if (mFontDataBuf) { nsZipCursor cursor(item, reader, mFontDataBuf, bufSize); cursor.Copy(&bufSize); @@ -136,7 +136,7 @@ public: if (mFace && mOwnsFace) { FT_Done_Face(mFace); if (mFontDataBuf) { - moz_free(mFontDataBuf); + free(mFontDataBuf); } } } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index a9a91c0d870a..276802ce5c35 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1152,7 +1152,7 @@ public: uint32_t size = offsetof(gfxShapedWord, mCharGlyphsStorage) + aLength * (sizeof(CompressedGlyph) + sizeof(uint8_t)); - void *storage = moz_malloc(size); + void *storage = malloc(size); if (!storage) { return nullptr; } @@ -1183,7 +1183,7 @@ public: uint32_t size = offsetof(gfxShapedWord, mCharGlyphsStorage) + aLength * (sizeof(CompressedGlyph) + sizeof(char16_t)); - void *storage = moz_malloc(size); + void *storage = malloc(size); if (!storage) { return nullptr; } @@ -1193,9 +1193,9 @@ public: } // Override operator delete to properly free the object that was - // allocated via moz_malloc. + // allocated via malloc. void operator delete(void* p) { - moz_free(p); + free(p); } virtual CompressedGlyph *GetCharacterGlyphs() override { diff --git a/gfx/thebes/gfxImageSurface.cpp b/gfx/thebes/gfxImageSurface.cpp index 5c1703975796..301d3a4da1d4 100644 --- a/gfx/thebes/gfxImageSurface.cpp +++ b/gfx/thebes/gfxImageSurface.cpp @@ -95,7 +95,7 @@ TryAllocAlignedBytes(size_t aSize) nullptr : ptr; #else // Oh well, hope that luck is with us in the allocator - return moz_malloc(aSize); + return malloc(aSize); #endif } diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index e6ba986b2acf..0c2c7a566079 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -106,7 +106,7 @@ gfxTextRun::AllocateStorageForTextRun(size_t aSize, uint32_t aLength) { // Allocate the storage we need, returning nullptr on failure rather than // throwing an exception (because web content can create huge runs). - void *storage = moz_malloc(aSize + aLength * sizeof(CompressedGlyph)); + void *storage = malloc(aSize + aLength * sizeof(CompressedGlyph)); if (!storage) { NS_WARNING("failed to allocate storage for text run!"); return nullptr; diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index 08bf8a200105..afc0e1e7938e 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -82,9 +82,9 @@ class gfxTextRun : public gfxShapedText { public: // Override operator delete to properly free the object that was - // allocated via moz_malloc. + // allocated via malloc. void operator delete(void* p) { - moz_free(p); + free(p); } virtual ~gfxTextRun(); diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index fde235d4d1f8..eba65c5eabae 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -675,7 +675,7 @@ gfxUserFontEntry::LoadPlatformFont(const uint8_t* aFontData, uint32_t& aLength) // The downloaded data can now be discarded; the font entry is using the // sanitized copy - moz_free((void*)aFontData); + free((void*)aFontData); return fe != nullptr; } @@ -690,7 +690,7 @@ gfxUserFontEntry::Load() // This is called when a font download finishes. // Ownership of aFontData passes in here, and the font set must -// ensure that it is eventually deleted via moz_free(). +// ensure that it is eventually deleted via free(). bool gfxUserFontEntry::FontDataDownloadComplete(const uint8_t* aFontData, uint32_t aLength, @@ -718,7 +718,7 @@ gfxUserFontEntry::FontDataDownloadComplete(const uint8_t* aFontData, } if (aFontData) { - moz_free((void*)aFontData); + free((void*)aFontData); } // error occurred, load next src diff --git a/image/decoders/nsBMPDecoder.cpp b/image/decoders/nsBMPDecoder.cpp index 168364030f2f..94e15b08347f 100644 --- a/image/decoders/nsBMPDecoder.cpp +++ b/image/decoders/nsBMPDecoder.cpp @@ -60,7 +60,7 @@ nsBMPDecoder::~nsBMPDecoder() { delete[] mColors; if (mRow) { - moz_free(mRow); + free(mRow); } } @@ -430,7 +430,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) if (mBIH.compression != BI_RLE8 && mBIH.compression != BI_RLE4 && mBIH.compression != BI_ALPHABITFIELDS) { // mRow is not used for RLE encoded images - mRow = (uint8_t*)moz_malloc((mBIH.width * mBIH.bpp) / 8 + 4); + mRow = (uint8_t*)malloc((mBIH.width * mBIH.bpp) / 8 + 4); // + 4 because the line is padded to a 4 bit boundary, but // I don't want to make exact calculations here, that's unnecessary. // Also, it compensates rounding error. diff --git a/image/decoders/nsGIFDecoder2.cpp b/image/decoders/nsGIFDecoder2.cpp index f70ab06b9a56..aee5085f0ea5 100644 --- a/image/decoders/nsGIFDecoder2.cpp +++ b/image/decoders/nsGIFDecoder2.cpp @@ -93,8 +93,8 @@ nsGIFDecoder2::nsGIFDecoder2(RasterImage* aImage) nsGIFDecoder2::~nsGIFDecoder2() { - moz_free(mGIFStruct.local_colormap); - moz_free(mGIFStruct.hold); + free(mGIFStruct.local_colormap); + free(mGIFStruct.hold); } void @@ -1161,8 +1161,8 @@ nsGIFDecoder2::SetHold(const uint8_t* buf1, uint32_t count1, uint32_t count2 /* = 0 */) { // We have to handle the case that buf currently points to hold - uint8_t* newHold = (uint8_t*) moz_malloc(std::max(uint32_t(MIN_HOLD_SIZE), - count1 + count2)); + uint8_t* newHold = (uint8_t*) malloc(std::max(uint32_t(MIN_HOLD_SIZE), + count1 + count2)); if (!newHold) { mGIFStruct.state = gif_error; return false; @@ -1173,7 +1173,7 @@ nsGIFDecoder2::SetHold(const uint8_t* buf1, uint32_t count1, memcpy(newHold + count1, buf2, count2); } - moz_free(mGIFStruct.hold); + free(mGIFStruct.hold); mGIFStruct.hold = newHold; mGIFStruct.bytes_in_hold = count1 + count2; return true; diff --git a/image/decoders/nsICODecoder.cpp b/image/decoders/nsICODecoder.cpp index dd8ead1bd652..e2ec0cea6a99 100644 --- a/image/decoders/nsICODecoder.cpp +++ b/image/decoders/nsICODecoder.cpp @@ -70,7 +70,7 @@ nsICODecoder::nsICODecoder(RasterImage* aImage) nsICODecoder::~nsICODecoder() { if (mRow) { - moz_free(mRow); + free(mRow); } } @@ -530,7 +530,7 @@ nsICODecoder::WriteInternal(const char* aBuffer, uint32_t aCount) mPos++; mRowBytes = 0; mCurLine = GetRealHeight(); - mRow = (uint8_t*)moz_realloc(mRow, rowSize); + mRow = (uint8_t*)realloc(mRow, rowSize); if (!mRow) { PostDecoderError(NS_ERROR_OUT_OF_MEMORY); return; diff --git a/image/decoders/nsPNGDecoder.cpp b/image/decoders/nsPNGDecoder.cpp index 7ec4b1c25e61..2833cb42bbf0 100644 --- a/image/decoders/nsPNGDecoder.cpp +++ b/image/decoders/nsPNGDecoder.cpp @@ -661,7 +661,7 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) (channels <= 2 || interlace_type == PNG_INTERLACE_ADAM7)) { uint32_t bpp[] = { 0, 3, 4, 3, 4 }; decoder->mCMSLine = - (uint8_t*)moz_malloc(bpp[channels] * width); + (uint8_t*)malloc(bpp[channels] * width); if (!decoder->mCMSLine) { png_longjmp(decoder->mPNG, 5); // NS_ERROR_OUT_OF_MEMORY } @@ -669,7 +669,7 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) if (interlace_type == PNG_INTERLACE_ADAM7) { if (height < INT32_MAX / (width * channels)) { - decoder->interlacebuf = (uint8_t*)moz_malloc(channels * width * height); + decoder->interlacebuf = (uint8_t*)malloc(channels * width * height); } if (!decoder->interlacebuf) { png_longjmp(decoder->mPNG, 5); // NS_ERROR_OUT_OF_MEMORY diff --git a/image/encoders/bmp/nsBMPEncoder.cpp b/image/encoders/bmp/nsBMPEncoder.cpp index 7fd00e591685..0f6a5614cf44 100644 --- a/image/encoders/bmp/nsBMPEncoder.cpp +++ b/image/encoders/bmp/nsBMPEncoder.cpp @@ -30,7 +30,7 @@ nsBMPEncoder::nsBMPEncoder() : mImageBufferStart(nullptr), nsBMPEncoder::~nsBMPEncoder() { if (mImageBufferStart) { - moz_free(mImageBufferStart); + free(mImageBufferStart); mImageBufferStart = nullptr; mImageBufferCurr = nullptr; } @@ -133,7 +133,7 @@ nsBMPEncoder::StartImageEncode(uint32_t aWidth, InitInfoHeader(version, bpp, aWidth, aHeight); mImageBufferSize = mBMPFileHeader.filesize; - mImageBufferStart = static_cast(moz_malloc(mImageBufferSize)); + mImageBufferStart = static_cast(malloc(mImageBufferSize)); if (!mImageBufferStart) { return NS_ERROR_OUT_OF_MEMORY; } @@ -316,7 +316,7 @@ NS_IMETHODIMP nsBMPEncoder::Close() { if (mImageBufferStart) { - moz_free(mImageBufferStart); + free(mImageBufferStart); mImageBufferStart = nullptr; mImageBufferSize = 0; mImageBufferReadPoint = 0; diff --git a/image/encoders/ico/nsICOEncoder.cpp b/image/encoders/ico/nsICOEncoder.cpp index b999dbb32c9c..c37a25e3c175 100644 --- a/image/encoders/ico/nsICOEncoder.cpp +++ b/image/encoders/ico/nsICOEncoder.cpp @@ -31,7 +31,7 @@ nsICOEncoder::nsICOEncoder() : mImageBufferStart(nullptr), nsICOEncoder::~nsICOEncoder() { if (mImageBufferStart) { - moz_free(mImageBufferStart); + free(mImageBufferStart); mImageBufferStart = nullptr; mImageBufferCurr = nullptr; } @@ -120,7 +120,7 @@ nsICOEncoder::AddImageFrame(const uint8_t* aData, mContainedEncoder->GetImageBufferUsed(&PNGImageBufferSize); mImageBufferSize = ICONFILEHEADERSIZE + ICODIRENTRYSIZE + PNGImageBufferSize; - mImageBufferStart = static_cast(moz_malloc(mImageBufferSize)); + mImageBufferStart = static_cast(malloc(mImageBufferSize)); if (!mImageBufferStart) { return NS_ERROR_OUT_OF_MEMORY; } @@ -154,7 +154,7 @@ nsICOEncoder::AddImageFrame(const uint8_t* aData, mContainedEncoder->GetImageBufferUsed(&BMPImageBufferSize); mImageBufferSize = ICONFILEHEADERSIZE + ICODIRENTRYSIZE + BMPImageBufferSize + andMaskSize; - mImageBufferStart = static_cast(moz_malloc(mImageBufferSize)); + mImageBufferStart = static_cast(malloc(mImageBufferSize)); if (!mImageBufferStart) { return NS_ERROR_OUT_OF_MEMORY; } @@ -334,7 +334,7 @@ NS_IMETHODIMP nsICOEncoder::Close() { if (mImageBufferStart) { - moz_free(mImageBufferStart); + free(mImageBufferStart); mImageBufferStart = nullptr; mImageBufferSize = 0; mImageBufferReadPoint = 0; diff --git a/image/encoders/jpeg/nsJPEGEncoder.cpp b/image/encoders/jpeg/nsJPEGEncoder.cpp index 4d04b3e2fe91..81ca381d576a 100644 --- a/image/encoders/jpeg/nsJPEGEncoder.cpp +++ b/image/encoders/jpeg/nsJPEGEncoder.cpp @@ -39,7 +39,7 @@ nsJPEGEncoder::nsJPEGEncoder() nsJPEGEncoder::~nsJPEGEncoder() { if (mImageBuffer) { - moz_free(mImageBuffer); + free(mImageBuffer); mImageBuffer = nullptr; } } @@ -243,7 +243,7 @@ NS_IMETHODIMP nsJPEGEncoder::Close() { if (mImageBuffer != nullptr) { - moz_free(mImageBuffer); + free(mImageBuffer); mImageBuffer = nullptr; mImageBufferSize = 0; mImageBufferUsed = 0; @@ -404,7 +404,7 @@ nsJPEGEncoder::initDestination(jpeg_compress_struct* cinfo) NS_ASSERTION(!that->mImageBuffer, "Image buffer already initialized"); that->mImageBufferSize = 8192; - that->mImageBuffer = (uint8_t*)moz_malloc(that->mImageBufferSize); + that->mImageBuffer = (uint8_t*)malloc(that->mImageBufferSize); that->mImageBufferUsed = 0; cinfo->dest->next_output_byte = that->mImageBuffer; @@ -438,11 +438,11 @@ nsJPEGEncoder::emptyOutputBuffer(jpeg_compress_struct* cinfo) // expand buffer, just double size each time that->mImageBufferSize *= 2; - uint8_t* newBuf = (uint8_t*)moz_realloc(that->mImageBuffer, - that->mImageBufferSize); + uint8_t* newBuf = (uint8_t*)realloc(that->mImageBuffer, + that->mImageBufferSize); if (!newBuf) { // can't resize, just zero (this will keep us from writing more) - moz_free(that->mImageBuffer); + free(that->mImageBuffer); that->mImageBuffer = nullptr; that->mImageBufferSize = 0; that->mImageBufferUsed = 0; diff --git a/image/encoders/png/nsPNGEncoder.cpp b/image/encoders/png/nsPNGEncoder.cpp index d9d34d5cc49f..d21ea4ebdbaa 100644 --- a/image/encoders/png/nsPNGEncoder.cpp +++ b/image/encoders/png/nsPNGEncoder.cpp @@ -42,7 +42,7 @@ nsPNGEncoder::nsPNGEncoder() : mPNG(nullptr), mPNGinfo(nullptr), nsPNGEncoder::~nsPNGEncoder() { if (mImageBuffer) { - moz_free(mImageBuffer); + free(mImageBuffer); mImageBuffer = nullptr; } // don't leak if EndImageEncode wasn't called @@ -155,7 +155,7 @@ nsPNGEncoder::StartImageEncode(uint32_t aWidth, // estimated size. Note: we don't have to worry about freeing this data // in this function. It will be freed on object destruction. mImageBufferSize = 8192; - mImageBuffer = (uint8_t*)moz_malloc(mImageBufferSize); + mImageBuffer = (uint8_t*)malloc(mImageBufferSize); if (!mImageBuffer) { png_destroy_write_struct(&mPNG, &mPNGinfo); return NS_ERROR_OUT_OF_MEMORY; @@ -532,7 +532,7 @@ NS_IMETHODIMP nsPNGEncoder::Close() { if (mImageBuffer != nullptr) { - moz_free(mImageBuffer); + free(mImageBuffer); mImageBuffer = nullptr; mImageBufferSize = 0; mImageBufferUsed = 0; @@ -733,11 +733,11 @@ nsPNGEncoder::WriteCallback(png_structp png, png_bytep data, // expand buffer, just double each time that->mImageBufferSize *= 2; - uint8_t* newBuf = (uint8_t*)moz_realloc(that->mImageBuffer, - that->mImageBufferSize); + uint8_t* newBuf = (uint8_t*)realloc(that->mImageBuffer, + that->mImageBufferSize); if (!newBuf) { // can't resize, just zero (this will keep us from writing more) - moz_free(that->mImageBuffer); + free(that->mImageBuffer); that->mImageBuffer = nullptr; that->mImageBufferSize = 0; that->mImageBufferUsed = 0; diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index 4b104cb63e81..aa295aa6aa92 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -161,7 +161,7 @@ imgFrame::~imgFrame() MOZ_ASSERT(mAborted || IsImageCompleteInternal()); #endif - moz_free(mPalettedImageData); + free(mPalettedImageData); mPalettedImageData = nullptr; } @@ -213,7 +213,7 @@ imgFrame::ReinitForDecoder(const nsIntSize& aImageSize, mOptSurface = nullptr; mVBuf = nullptr; mVBufPtr = nullptr; - moz_free(mPalettedImageData); + free(mPalettedImageData); mPalettedImageData = nullptr; // Reinitialize. @@ -274,10 +274,10 @@ imgFrame::InitForDecoder(const nsIntSize& aImageSize, // Use the fallible allocator here. Paletted images always use 1 byte per // pixel, so calculating the amount of memory we need is straightforward. mPalettedImageData = - static_cast(moz_malloc(PaletteDataLength() + - (mSize.width * mSize.height))); + static_cast(malloc(PaletteDataLength() + + (mSize.width * mSize.height))); if (!mPalettedImageData) - NS_WARNING("moz_malloc for paletted image data should succeed"); + NS_WARNING("malloc for paletted image data should succeed"); NS_ENSURE_TRUE(mPalettedImageData, NS_ERROR_OUT_OF_MEMORY); } else { MOZ_ASSERT(!mImageSurface, "Called imgFrame::InitForDecoder() twice?"); diff --git a/intl/hyphenation/hnjalloc.h b/intl/hyphenation/hnjalloc.h index a5e7693227e3..fec3a4bc9009 100644 --- a/intl/hyphenation/hnjalloc.h +++ b/intl/hyphenation/hnjalloc.h @@ -14,7 +14,7 @@ #define hnj_malloc(size) moz_xmalloc(size) #define hnj_realloc(p, size) moz_xrealloc(p, size) -#define hnj_free(p) moz_free(p) +#define hnj_free(p) free(p) /* * To enable us to load hyphenation dictionaries from arbitrary resource URIs, diff --git a/intl/locale/mac/nsCollationMacUC.cpp b/intl/locale/mac/nsCollationMacUC.cpp index c650b252b221..94a1e07614bf 100644 --- a/intl/locale/mac/nsCollationMacUC.cpp +++ b/intl/locale/mac/nsCollationMacUC.cpp @@ -40,12 +40,12 @@ nsCollationMacUC::~nsCollationMacUC() NS_ASSERTION(NS_SUCCEEDED(res), "CleanUpCollator failed"); if (mUseICU) { if (mLocaleICU) { - moz_free(mLocaleICU); + free(mLocaleICU); mLocaleICU = nullptr; } } else { if (mBuffer) { - moz_free(mBuffer); + free(mBuffer); mBuffer = nullptr; } } @@ -111,7 +111,7 @@ nsresult nsCollationMacUC::ConvertLocaleICU(nsILocale* aNSLocale, char** aICULoc NS_ERROR_FAILURE); NS_LossyConvertUTF16toASCII tmp(localeString); tmp.ReplaceChar('-', '_'); - char* locale = (char*)moz_malloc(tmp.Length() + 1); + char* locale = (char*)malloc(tmp.Length() + 1); if (!locale) { return NS_ERROR_OUT_OF_MEMORY; } @@ -273,13 +273,13 @@ NS_IMETHODIMP nsCollationMacUC::AllocateRawSortKey(int32_t strength, const nsASt do { newBufferLen *= 2; } while (newBufferLen < maxKeyLen); - void* newBuffer = moz_malloc(newBufferLen); + void* newBuffer = malloc(newBufferLen); if (!newBuffer) { return NS_ERROR_OUT_OF_MEMORY; } if (mBuffer) { - moz_free(mBuffer); + free(mBuffer); mBuffer = nullptr; } mBuffer = newBuffer; diff --git a/intl/uconv/nsScriptableUConv.cpp b/intl/uconv/nsScriptableUConv.cpp index 8bca5060544f..510c77c22430 100644 --- a/intl/uconv/nsScriptableUConv.cpp +++ b/intl/uconv/nsScriptableUConv.cpp @@ -39,7 +39,7 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc const nsAFlatString& flatSrc = PromiseFlatString(aSrc); rv = mEncoder->GetMaxLength(flatSrc.get(), inLength, aOutLen); if (NS_SUCCEEDED(rv)) { - *_retval = (char*)moz_malloc(*aOutLen+1); + *_retval = (char*)malloc(*aOutLen+1); if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; @@ -49,7 +49,7 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc (*_retval)[*aOutLen] = '\0'; return NS_OK; } - moz_free(*_retval); + free(*_retval); } *_retval = nullptr; return NS_ERROR_FAILURE; @@ -68,7 +68,7 @@ nsScriptableUnicodeConverter::ConvertFromUnicode(const nsAString& aSrc, if (!_retval.Assign(str, len, mozilla::fallible)) { rv = NS_ERROR_OUT_OF_MEMORY; } - moz_free(str); + free(str); } return rv; } @@ -81,7 +81,7 @@ nsScriptableUnicodeConverter::FinishWithLength(char **_retval, int32_t* aLength) int32_t finLength = 32; - *_retval = (char *)moz_malloc(finLength); + *_retval = (char *)malloc(finLength); if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; @@ -89,7 +89,7 @@ nsScriptableUnicodeConverter::FinishWithLength(char **_retval, int32_t* aLength) if (NS_SUCCEEDED(rv)) *aLength = finLength; else - moz_free(*_retval); + free(*_retval); return rv; @@ -117,7 +117,7 @@ nsScriptableUnicodeConverter::Finish(nsACString& _retval) if (!_retval.Assign(str, len, mozilla::fallible)) { rv = NS_ERROR_OUT_OF_MEMORY; } - moz_free(str); + free(str); } return rv; } @@ -151,7 +151,7 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData, inLength, &outLength); if (NS_SUCCEEDED(rv)) { - char16_t* buf = (char16_t*)moz_malloc((outLength+1)*sizeof(char16_t)); + char16_t* buf = (char16_t*)malloc((outLength+1) * sizeof(char16_t)); if (!buf) return NS_ERROR_OUT_OF_MEMORY; @@ -164,7 +164,7 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData, rv = NS_ERROR_OUT_OF_MEMORY; } } - moz_free(buf); + free(buf); return rv; } return NS_ERROR_FAILURE; @@ -193,9 +193,9 @@ nsScriptableUnicodeConverter::ConvertToByteArray(const nsAString& aString, return rv; str.Append(data, len); - moz_free(data); + free(data); // NOTE: this being a byte array, it needs no null termination - *_aData = reinterpret_cast(moz_malloc(str.Length())); + *_aData = reinterpret_cast(malloc(str.Length())); if (!*_aData) return NS_ERROR_OUT_OF_MEMORY; memcpy(*_aData, str.get(), str.Length()); @@ -222,7 +222,7 @@ nsScriptableUnicodeConverter::ConvertToInputStream(const nsAString& aString, rv = inputStream->AdoptData(reinterpret_cast(data), dataLen); if (NS_FAILED(rv)) { - moz_free(data); + free(data); return rv; } diff --git a/ipc/keystore/KeyStore.cpp b/ipc/keystore/KeyStore.cpp index 0371030526e8..c6433789c238 100644 --- a/ipc/keystore/KeyStore.cpp +++ b/ipc/keystore/KeyStore.cpp @@ -109,7 +109,7 @@ status_t BnKeystoreService::onTransact(uint32_t code, const Parcel& data, Parcel reply->writeInt32(dataLength); void* buf = reply->writeInplace(dataLength); memcpy(buf, data, dataLength); - moz_free(data); + free(data); } else { reply->writeInt32(-1); } @@ -127,7 +127,7 @@ status_t BnKeystoreService::onTransact(uint32_t code, const Parcel& data, Parcel reply->writeInt32(dataLength); void* buf = reply->writeInplace(dataLength); memcpy(buf, data, dataLength); - moz_free(data); + free(data); } else { reply->writeInt32(-1); } @@ -153,7 +153,7 @@ status_t BnKeystoreService::onTransact(uint32_t code, const Parcel& data, Parcel reply->writeInt32(signResultSize); void* buf = reply->writeInplace(signResultSize); memcpy(buf, signResult, signResultSize); - moz_free(signResult); + free(signResult); } else { reply->writeInt32(-1); } @@ -326,7 +326,7 @@ FormatCaData(const char *aCaData, int aCaDataLength, size_t bufSize = strlen(CA_BEGIN) + strlen(CA_END) + strlen(CA_TAILER) * 2 + strlen(aName) * 2 + aCaDataLength + aCaDataLength/CA_LINE_SIZE + 2; - char *buf = (char *)moz_malloc(bufSize); + char *buf = (char *)malloc(bufSize); if (!buf) { *aFormatData = nullptr; return; @@ -571,7 +571,7 @@ ResponseCode getPublicKey(const char *aKeyName, const uint8_t **aKeyData, } size_t bufSize = keyItem->len; - char *buf = (char *)moz_malloc(bufSize); + char *buf = (char *)malloc(bufSize); if (!buf) { return SYSTEM_ERROR; } @@ -647,7 +647,7 @@ ResponseCode signData(const char *aKeyName, const uint8_t *data, size_t length, return SYSTEM_ERROR; } - uint8_t *buf = (uint8_t *)moz_malloc(signItem->len); + uint8_t *buf = (uint8_t *)malloc(signItem->len); if (!buf) { return SYSTEM_ERROR; } @@ -1073,7 +1073,7 @@ KeyStore::ReceiveSocketData(nsAutoPtr& aMessage) SendResponse(SUCCESS); SendData(data, (int)dataLength); - moz_free((void *)data); + free((void *)data); } ResetHandlerInfo(); diff --git a/layout/base/nsBidi.cpp b/layout/base/nsBidi.cpp index de646ef54e36..ff623bb9200f 100644 --- a/layout/base/nsBidi.cpp +++ b/layout/base/nsBidi.cpp @@ -190,7 +190,7 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t if(!aMayAllocate) { return false; } else { - *aMemory=moz_malloc(aSizeNeeded); + *aMemory=malloc(aSizeNeeded); if (*aMemory!=nullptr) { *aSize=aSizeNeeded; return true; @@ -206,7 +206,7 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t return false; } else if(aSizeNeeded!=*aSize && aMayAllocate) { /* we may try to grow or shrink */ - void *memory=moz_realloc(*aMemory, aSizeNeeded); + void *memory=realloc(*aMemory, aSizeNeeded); if(memory!=nullptr) { *aMemory=memory; @@ -225,11 +225,11 @@ bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t void nsBidi::Free() { - moz_free(mDirPropsMemory); + free(mDirPropsMemory); mDirPropsMemory = nullptr; - moz_free(mLevelsMemory); + free(mLevelsMemory); mLevelsMemory = nullptr; - moz_free(mRunsMemory); + free(mRunsMemory); mRunsMemory = nullptr; } diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp index b6c7ec231056..da9379dc6da4 100644 --- a/layout/generic/nsFontInflationData.cpp +++ b/layout/generic/nsFontInflationData.cpp @@ -168,7 +168,7 @@ ComputeDescendantISize(const nsHTMLReflowState& aAncestorReflowState, for (uint32_t i = len; i-- != 0; ) { reflowStates[i].~nsHTMLReflowState(); } - moz_free(reflowStates); + free(reflowStates); return result; } diff --git a/layout/style/FontFace.cpp b/layout/style/FontFace.cpp index b9ca5d929877..e90932fb564a 100644 --- a/layout/style/FontFace.cpp +++ b/layout/style/FontFace.cpp @@ -50,10 +50,10 @@ GetDataFrom(const T& aObject, uint8_t*& aBuffer, uint32_t& aLength) { MOZ_ASSERT(!aBuffer); aObject.ComputeLengthAndData(); - // We use moz_malloc here rather than a FallibleTArray or fallible - // operator new[] since the gfxUserFontEntry will be calling moz_free + // We use malloc here rather than a FallibleTArray or fallible + // operator new[] since the gfxUserFontEntry will be calling free // on it. - aBuffer = (uint8_t*) moz_malloc(aObject.Length()); + aBuffer = (uint8_t*) malloc(aObject.Length()); if (!aBuffer) { return; } diff --git a/media/webrtc/signaling/src/common/time_profiling/timecard.c b/media/webrtc/signaling/src/common/time_profiling/timecard.c index cadb9862f44c..e56377534cf5 100644 --- a/media/webrtc/signaling/src/common/time_profiling/timecard.c +++ b/media/webrtc/signaling/src/common/time_profiling/timecard.c @@ -21,8 +21,8 @@ create_timecard() void destroy_timecard(Timecard *tc) { - moz_free(tc->entries); - moz_free(tc); + free(tc->entries); + free(tc); } void diff --git a/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c b/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c index 819d8656fe6e..c210c39714da 100644 --- a/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c +++ b/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c @@ -15,7 +15,7 @@ #define cpr_malloc(a) moz_xmalloc(a) #define cpr_calloc(a, b) moz_xcalloc(a, b) #define cpr_realloc(a, b) moz_xrealloc(a, b) -#define cpr_free(a) moz_free(a) +#define cpr_free(a) free(a) /** diff --git a/netwerk/base/nsIStreamLoader.idl b/netwerk/base/nsIStreamLoader.idl index 83bc92c60a7e..2ff420a08bca 100644 --- a/netwerk/base/nsIStreamLoader.idl +++ b/netwerk/base/nsIStreamLoader.idl @@ -27,8 +27,8 @@ interface nsIStreamLoaderObserver : nsISupports * If the observer wants to take over responsibility for the * data buffer (result), it returns NS_SUCCESS_ADOPTED_DATA * in place of NS_OK as its success code. The loader will then - * "forget" about the data and not moz_free() it after - * onStreamComplete() returns; observer must call moz_free() + * "forget" about the data and not free() it after + * onStreamComplete() returns; observer must call free() * when the data is no longer required. */ void onStreamComplete(in nsIStreamLoader loader, diff --git a/netwerk/base/nsPreloadedStream.cpp b/netwerk/base/nsPreloadedStream.cpp index 9160a13a5836..3246f34d6353 100644 --- a/netwerk/base/nsPreloadedStream.cpp +++ b/netwerk/base/nsPreloadedStream.cpp @@ -28,7 +28,7 @@ nsPreloadedStream::nsPreloadedStream(nsIAsyncInputStream *aStream, nsPreloadedStream::~nsPreloadedStream() { - moz_free(mBuf); + free(mBuf); } NS_IMETHODIMP diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 3833053c1d46..4761ab697f2c 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -103,9 +103,9 @@ nsSocketTransportService::~nsSocketTransportService() if (mThreadEvent) PR_DestroyPollableEvent(mThreadEvent); - moz_free(mActiveList); - moz_free(mIdleList); - moz_free(mPollList); + free(mActiveList); + free(mIdleList); + free(mPollList); gSocketTransportService = nullptr; } diff --git a/netwerk/cache/nsCacheMetaData.cpp b/netwerk/cache/nsCacheMetaData.cpp index 71025ad96f88..0df867d839cd 100644 --- a/netwerk/cache/nsCacheMetaData.cpp +++ b/netwerk/cache/nsCacheMetaData.cpp @@ -151,7 +151,7 @@ nsresult nsCacheMetaData::EnsureBuffer(uint32_t bufSize) { if (mBufferSize < bufSize) { - char * buf = (char *)moz_realloc(mBuffer, bufSize); + char * buf = (char *)realloc(mBuffer, bufSize); if (!buf) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/netwerk/cache/nsCacheMetaData.h b/netwerk/cache/nsCacheMetaData.h index e0879c1473f2..8ac19125a629 100644 --- a/netwerk/cache/nsCacheMetaData.h +++ b/netwerk/cache/nsCacheMetaData.h @@ -18,7 +18,7 @@ public: ~nsCacheMetaData() { mBufferSize = mMetaSize = 0; - moz_free(mBuffer); + free(mBuffer); mBuffer = nullptr; } diff --git a/netwerk/cache2/CacheFileChunk.cpp b/netwerk/cache2/CacheFileChunk.cpp index 334fe80f3943..8d13330366b6 100644 --- a/netwerk/cache2/CacheFileChunk.cpp +++ b/netwerk/cache2/CacheFileChunk.cpp @@ -185,7 +185,7 @@ CacheFileChunk::Read(CacheFileHandle *aHandle, uint32_t aLen, mState = READING; if (CanAllocate(aLen)) { - mRWBuf = static_cast(moz_malloc(aLen)); + mRWBuf = static_cast(malloc(aLen)); if (mRWBuf) { mRWBufSize = aLen; ChunkAllocationChanged(); @@ -698,7 +698,7 @@ CacheFileChunk::EnsureBufSize(uint32_t aBufSize) return mStatus; } - char *newBuf = static_cast(moz_realloc(mBuf, aBufSize)); + char *newBuf = static_cast(realloc(mBuf, aBufSize)); if (!newBuf) { SetError(NS_ERROR_OUT_OF_MEMORY); return mStatus; diff --git a/netwerk/dns/DNS.cpp b/netwerk/dns/DNS.cpp index 817dc1097f73..0756dca356b1 100644 --- a/netwerk/dns/DNS.cpp +++ b/netwerk/dns/DNS.cpp @@ -287,8 +287,8 @@ AddrInfo::~AddrInfo() while ((addrElement = mAddresses.popLast())) { delete addrElement; } - moz_free(mHostName); - moz_free(mCanonicalName); + free(mHostName); + free(mCanonicalName); } void diff --git a/netwerk/protocol/http/SpdyZlibReporter.cpp b/netwerk/protocol/http/SpdyZlibReporter.cpp index 7348b882b461..f6ae6577e8cc 100644 --- a/netwerk/protocol/http/SpdyZlibReporter.cpp +++ b/netwerk/protocol/http/SpdyZlibReporter.cpp @@ -24,7 +24,7 @@ SpdyZlibReporter::Alloc(void*, uInt items, uInt size) SpdyZlibReporter::Free(void*, void* p) { sAmount -= MallocSizeOfOnFree(p); - moz_free(p); + free(p); } NS_IMETHODIMP diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 667c8471aa38..e8e52765e585 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -1170,8 +1170,8 @@ WebSocketChannel::~WebSocketChannel() MOZ_ASSERT(!mCancelable, "DNS/Proxy Request still alive at destruction"); MOZ_ASSERT(!mConnecting, "Should not be connecting in destructor"); - moz_free(mBuffer); - moz_free(mDynamicOutput); + free(mBuffer); + free(mDynamicOutput); delete mCurrentOut; while ((mCurrentOut = (OutboundMessage *) mOutgoingPingMessages.PopFront())) @@ -1400,7 +1400,7 @@ WebSocketChannel::UpdateReadBuffer(uint8_t *buffer, uint32_t count, mBufferSize += count + 8192 + mBufferSize/3; LOG(("WebSocketChannel: update read buffer extended to %u\n", mBufferSize)); uint8_t *old = mBuffer; - mBuffer = (uint8_t *)moz_realloc(mBuffer, mBufferSize); + mBuffer = (uint8_t *)realloc(mBuffer, mBufferSize); if (!mBuffer) { mBuffer = old; return false; @@ -1777,7 +1777,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) // release memory if we've been processing a large message if (mBufferSize > kIncomingBufferStableSize) { mBufferSize = kIncomingBufferStableSize; - moz_free(mBuffer); + free(mBuffer); mBuffer = (uint8_t *)moz_xmalloc(mBufferSize); } } diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 281cd038f006..0e8b9ea114a9 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -1008,7 +1008,7 @@ DataChannelConnection::SendOpenRequestMessage(const nsACString& label, break; default: // FIX! need to set errno! Or make all these SendXxxx() funcs return 0 or errno! - moz_free(req); + free(req); return (0); } if (unordered) { @@ -1025,7 +1025,7 @@ DataChannelConnection::SendOpenRequestMessage(const nsACString& label, int32_t result = SendControlMessage(req, req_size, stream); - moz_free(req); + free(req); return result; } @@ -1731,7 +1731,7 @@ DataChannelConnection::SendOutgoingStreamReset() } else { mStreamsResetting.Clear(); } - moz_free(srs); + free(srs); } void diff --git a/netwerk/sctp/datachannel/DataChannel.h b/netwerk/sctp/datachannel/DataChannel.h index 7147ded17db7..180568c0978b 100644 --- a/netwerk/sctp/datachannel/DataChannel.h +++ b/netwerk/sctp/datachannel/DataChannel.h @@ -83,7 +83,7 @@ public: ~QueuedDataMessage() { - moz_free(mData); + free(mData); } uint16_t mStream; diff --git a/netwerk/streamconv/converters/nsBinHexDecoder.cpp b/netwerk/streamconv/converters/nsBinHexDecoder.cpp index 9c78cebe4a1f..372da8d37517 100644 --- a/netwerk/streamconv/converters/nsBinHexDecoder.cpp +++ b/netwerk/streamconv/converters/nsBinHexDecoder.cpp @@ -442,8 +442,8 @@ nsBinHexDecoder::OnStartRequest(nsIRequest* request, nsISupports *aCtxt) NS_ENSURE_TRUE(mNextListener, NS_ERROR_FAILURE); - mDataBuffer = (char *) moz_malloc((sizeof(char) * nsIOService::gDefaultSegmentSize)); - mOutgoingBuffer = (char *) moz_malloc((sizeof(char) * nsIOService::gDefaultSegmentSize)); + mDataBuffer = (char *) malloc((sizeof(char) * nsIOService::gDefaultSegmentSize)); + mOutgoingBuffer = (char *) malloc((sizeof(char) * nsIOService::gDefaultSegmentSize)); if (!mDataBuffer || !mOutgoingBuffer) return NS_ERROR_FAILURE; // out of memory; // now we want to create a pipe which we'll use to write our converted data... diff --git a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp index 656066d27184..d821c919e0c7 100644 --- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp +++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp @@ -151,20 +151,20 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, if (mInpBuffer != nullptr && streamLen > mInpBufferLen) { - mInpBuffer = (unsigned char *) moz_realloc(mInpBuffer, mInpBufferLen = streamLen); + mInpBuffer = (unsigned char *) realloc(mInpBuffer, mInpBufferLen = streamLen); if (mOutBufferLen < streamLen * 2) - mOutBuffer = (unsigned char *) moz_realloc(mOutBuffer, mOutBufferLen = streamLen * 3); + mOutBuffer = (unsigned char *) realloc(mOutBuffer, mOutBufferLen = streamLen * 3); if (mInpBuffer == nullptr || mOutBuffer == nullptr) return NS_ERROR_OUT_OF_MEMORY; } if (mInpBuffer == nullptr) - mInpBuffer = (unsigned char *) moz_malloc(mInpBufferLen = streamLen); + mInpBuffer = (unsigned char *) malloc(mInpBufferLen = streamLen); if (mOutBuffer == nullptr) - mOutBuffer = (unsigned char *) moz_malloc(mOutBufferLen = streamLen * 3); + mOutBuffer = (unsigned char *) malloc(mOutBufferLen = streamLen * 3); if (mInpBuffer == nullptr || mOutBuffer == nullptr) return NS_ERROR_OUT_OF_MEMORY; diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index 536f139ab8c2..5b3d3b907fae 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -480,7 +480,7 @@ nsHtml5StreamParser::FinalizeSniffing(const uint8_t* aFromSegment, // can be nul { (void *(*)(size_t))moz_xmalloc, (void *(*)(void *, size_t))moz_xrealloc, - moz_free + free }; static const char16_t kExpatSeparator[] = { 0xFFFF, '\0' }; diff --git a/rdf/base/nsRDFContentSink.cpp b/rdf/base/nsRDFContentSink.cpp index 8c8eccb3008a..6e9ab71a3d74 100644 --- a/rdf/base/nsRDFContentSink.cpp +++ b/rdf/base/nsRDFContentSink.cpp @@ -343,7 +343,7 @@ RDFContentSinkImpl::~RDFContentSinkImpl() delete mContextStack; } - moz_free(mText); + free(mText); if (--gRefCnt == 0) { @@ -755,7 +755,7 @@ RDFContentSinkImpl::AddText(const char16_t* aText, int32_t aLength) { // Create buffer when we first need it if (0 == mTextSize) { - mText = (char16_t *) moz_malloc(sizeof(char16_t) * 4096); + mText = (char16_t *) malloc(sizeof(char16_t) * 4096); if (!mText) { return NS_ERROR_OUT_OF_MEMORY; } @@ -773,7 +773,7 @@ RDFContentSinkImpl::AddText(const char16_t* aText, int32_t aLength) int32_t newSize = (2 * mTextSize > (mTextSize + aLength)) ? (2 * mTextSize) : (mTextSize + aLength); char16_t* newText = - (char16_t *) moz_realloc(mText, sizeof(char16_t) * newSize); + (char16_t *) realloc(mText, sizeof(char16_t) * newSize); if (!newText) return NS_ERROR_OUT_OF_MEMORY; mTextSize = newSize; diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp index 99fdf76cdcd2..b288cbf0079b 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp @@ -609,7 +609,7 @@ nsHTTPListener::~nsHTTPListener() send_done_signal(); if (mResultData) { - moz_free(const_cast(mResultData)); + free(const_cast(mResultData)); } if (mLoader) { diff --git a/storage/src/mozStorageService.cpp b/storage/src/mozStorageService.cpp index addb88abf947..19131358cf22 100644 --- a/storage/src/mozStorageService.cpp +++ b/storage/src/mozStorageService.cpp @@ -402,10 +402,10 @@ namespace { // allocated for a given request. SQLite uses this function before all // allocations, and may be able to use any excess bytes caused by the rounding. // -// Note: the wrappers for moz_malloc, moz_realloc and moz_malloc_usable_size -// are necessary because the sqlite_mem_methods type signatures differ slightly +// Note: the wrappers for malloc, realloc and moz_malloc_usable_size are +// necessary because the sqlite_mem_methods type signatures differ slightly // from the standard ones -- they use int instead of size_t. But we don't need -// a wrapper for moz_free. +// a wrapper for free. #ifdef MOZ_DMD @@ -429,7 +429,7 @@ MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree) static void *sqliteMemMalloc(int n) { - void* p = ::moz_malloc(n); + void* p = ::malloc(n); #ifdef MOZ_DMD gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p); #endif @@ -441,14 +441,14 @@ static void sqliteMemFree(void *p) #ifdef MOZ_DMD gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p); #endif - ::moz_free(p); + ::free(p); } static void *sqliteMemRealloc(void *p, int n) { #ifdef MOZ_DMD gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p); - void *pnew = ::moz_realloc(p, n); + void *pnew = ::realloc(p, n); if (pnew) { gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew); } else { @@ -457,7 +457,7 @@ static void *sqliteMemRealloc(void *p, int n) } return pnew; #else - return ::moz_realloc(p, n); + return ::realloc(p, n); #endif } diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 778ee297025a..5f46c4532a49 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -218,7 +218,7 @@ NS_Realloc(void* aPtr, size_t aSize) XPCOM_API(void) NS_Free(void* aPtr) { - moz_free(aPtr); + free(aPtr); } nsresult diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index b0dbc8071319..59b9291970fb 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -167,13 +167,13 @@ struct nsTArrayInfallibleAllocatorBase struct nsTArrayFallibleAllocator : nsTArrayFallibleAllocatorBase { - static void* Malloc(size_t aSize) { return moz_malloc(aSize); } + static void* Malloc(size_t aSize) { return malloc(aSize); } static void* Realloc(void* aPtr, size_t aSize) { - return moz_realloc(aPtr, aSize); + return realloc(aPtr, aSize); } - static void Free(void* aPtr) { moz_free(aPtr); } + static void Free(void* aPtr) { free(aPtr); } static void SizeTooBig(size_t) {} }; @@ -185,7 +185,7 @@ struct nsTArrayInfallibleAllocator : nsTArrayInfallibleAllocatorBase return moz_xrealloc(aPtr, aSize); } - static void Free(void* aPtr) { moz_free(aPtr); } + static void Free(void* aPtr) { free(aPtr); } static void SizeTooBig(size_t aSize) { NS_ABORT_OOM(aSize); } }; diff --git a/xpcom/io/nsBinaryStream.cpp b/xpcom/io/nsBinaryStream.cpp index 289730f076c0..88390fb61834 100644 --- a/xpcom/io/nsBinaryStream.cpp +++ b/xpcom/io/nsBinaryStream.cpp @@ -228,7 +228,7 @@ nsBinaryOutputStream::WriteWStringZ(const char16_t* aString) if (length <= 64) { copy = temp; } else { - copy = reinterpret_cast(moz_malloc(byteCount)); + copy = reinterpret_cast(malloc(byteCount)); if (!copy) { return NS_ERROR_OUT_OF_MEMORY; } @@ -237,7 +237,7 @@ nsBinaryOutputStream::WriteWStringZ(const char16_t* aString) mozilla::NativeEndian::copyAndSwapToBigEndian(copy, aString, length); rv = WriteBytes(reinterpret_cast(copy), byteCount); if (copy != temp) { - moz_free(copy); + free(copy); } #endif @@ -798,18 +798,18 @@ nsBinaryInputStream::ReadBytes(uint32_t aLength, char** aResult) uint32_t bytesRead; char* s; - s = reinterpret_cast(moz_malloc(aLength)); + s = reinterpret_cast(malloc(aLength)); if (!s) { return NS_ERROR_OUT_OF_MEMORY; } rv = Read(s, aLength, &bytesRead); if (NS_FAILED(rv)) { - moz_free(s); + free(s); return rv; } if (bytesRead != aLength) { - moz_free(s); + free(s); return NS_ERROR_FAILURE; } diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 2628c8ebd74e..dfb1fa143d84 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -1745,7 +1745,7 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& aResult) } } } - moz_free(ver); + free(ver); return rv; } diff --git a/xpcom/io/nsScriptableInputStream.cpp b/xpcom/io/nsScriptableInputStream.cpp index cc4ee1361b2a..ba50edd6316d 100644 --- a/xpcom/io/nsScriptableInputStream.cpp +++ b/xpcom/io/nsScriptableInputStream.cpp @@ -58,7 +58,7 @@ nsScriptableInputStream::Read(uint32_t aCount, char** aResult) // bug716556 - Ensure count+1 doesn't overflow uint32_t count = XPCOM_MIN((uint32_t)XPCOM_MIN(count64, aCount), UINT32_MAX - 1); - buffer = (char*)moz_malloc(count + 1); // make room for '\0' + buffer = (char*)malloc(count + 1); // make room for '\0' if (!buffer) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/xpcom/io/nsSegmentedBuffer.cpp b/xpcom/io/nsSegmentedBuffer.cpp index 849b3cd7cbee..487333f3b394 100644 --- a/xpcom/io/nsSegmentedBuffer.cpp +++ b/xpcom/io/nsSegmentedBuffer.cpp @@ -64,7 +64,7 @@ nsSegmentedBuffer::AppendNewSegment() mSegmentArrayCount = newArraySize; } - char* seg = (char*)moz_malloc(mSegmentSize); + char* seg = (char*)malloc(mSegmentSize); if (!seg) { return nullptr; } @@ -77,7 +77,7 @@ bool nsSegmentedBuffer::DeleteFirstSegment() { NS_ASSERTION(mSegmentArray[mFirstSegmentIndex] != nullptr, "deleting bad segment"); - moz_free(mSegmentArray[mFirstSegmentIndex]); + free(mSegmentArray[mFirstSegmentIndex]); mSegmentArray[mFirstSegmentIndex] = nullptr; int32_t last = ModSegArraySize(mLastSegmentIndex - 1); if (mFirstSegmentIndex == last) { @@ -94,7 +94,7 @@ nsSegmentedBuffer::DeleteLastSegment() { int32_t last = ModSegArraySize(mLastSegmentIndex - 1); NS_ASSERTION(mSegmentArray[last] != nullptr, "deleting bad segment"); - moz_free(mSegmentArray[last]); + free(mSegmentArray[last]); mSegmentArray[last] = nullptr; mLastSegmentIndex = last; return (bool)(mLastSegmentIndex == mFirstSegmentIndex); @@ -105,7 +105,7 @@ nsSegmentedBuffer::ReallocLastSegment(size_t aNewSize) { int32_t last = ModSegArraySize(mLastSegmentIndex - 1); NS_ASSERTION(mSegmentArray[last] != nullptr, "realloc'ing bad segment"); - char* newSegment = (char*)moz_realloc(mSegmentArray[last], aNewSize); + char* newSegment = (char*)realloc(mSegmentArray[last], aNewSize); if (newSegment) { mSegmentArray[last] = newSegment; return true; @@ -119,7 +119,7 @@ nsSegmentedBuffer::Empty() if (mSegmentArray) { for (uint32_t i = 0; i < mSegmentArrayCount; i++) { if (mSegmentArray[i]) { - moz_free(mSegmentArray[i]); + free(mSegmentArray[i]); } } nsMemory::Free(mSegmentArray); diff --git a/xpcom/typelib/xpt/moz.build b/xpcom/typelib/xpt/moz.build index 0dd5e3a2cd92..af0a016ef8f0 100644 --- a/xpcom/typelib/xpt/moz.build +++ b/xpcom/typelib/xpt/moz.build @@ -31,8 +31,8 @@ if CONFIG['_MSC_VER']: CFLAGS += ['-Zl'] # Code with FINAL_LIBRARY = 'xul' shouldn't do this, but the code -# here doesn't use moz_malloc functions anyways, while not setting +# here doesn't use malloc functions anyways, while not setting # MOZ_NO_MOZALLOC makes the code include mozalloc.h, which includes # inline operator new definitions that MSVC linker doesn't strip -# when linking the xpt tests without mozalloc. +# when linking the xpt tests. DEFINES['MOZ_NO_MOZALLOC'] = True