From 11efb2f6a899022f1a8b51cae3ff1679a837d3a7 Mon Sep 17 00:00:00 2001 From: David Major Date: Mon, 4 May 2015 07:33:00 +0200 Subject: [PATCH] Bug 1159604 - Use fallible allocations in nsLinebreakConverter.cpp (as the code expects). r=smaug --- xpcom/io/nsLinebreakConverter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xpcom/io/nsLinebreakConverter.cpp b/xpcom/io/nsLinebreakConverter.cpp index 67bee7a1d77..db4487fb00a 100644 --- a/xpcom/io/nsLinebreakConverter.cpp +++ b/xpcom/io/nsLinebreakConverter.cpp @@ -100,7 +100,7 @@ ConvertBreaks(const T* aInSrc, int32_t& aIoLen, const char* aSrcBreak, // handle the no conversion case if (nsCRT::strcmp(aSrcBreak, aDestBreak) == 0) { - resultString = (T*)moz_xmalloc(sizeof(T) * aIoLen); + resultString = (T*)malloc(sizeof(T) * aIoLen); if (!resultString) { return nullptr; } @@ -114,7 +114,7 @@ ConvertBreaks(const T* aInSrc, int32_t& aIoLen, const char* aSrcBreak, // handle the easy case, where the string length does not change, and the // breaks are only 1 char long, i.e. CR <-> LF if (srcBreakLen == destBreakLen && srcBreakLen == 1) { - resultString = (T*)moz_xmalloc(sizeof(T) * aIoLen); + resultString = (T*)malloc(sizeof(T) * aIoLen); if (!resultString) { return nullptr; } @@ -144,7 +144,7 @@ ConvertBreaks(const T* aInSrc, int32_t& aIoLen, const char* aSrcBreak, int32_t newBufLen = aIoLen - (numLinebreaks * srcBreakLen) + (numLinebreaks * destBreakLen); - resultString = (T*)moz_xmalloc(sizeof(T) * newBufLen); + resultString = (T*)malloc(sizeof(T) * newBufLen); if (!resultString) { return nullptr; } @@ -235,7 +235,7 @@ ConvertUnknownBreaks(const T* aInSrc, int32_t& aIoLen, const char* aDestBreak) src++; } - T* resultString = (T*)moz_xmalloc(sizeof(T) * finalLen); + T* resultString = (T*)malloc(sizeof(T) * finalLen); if (!resultString) { return nullptr; }