Author: post
Date: 2012-10-08 20:46:57 +0200 (Mon, 08 Oct 2012)
New Revision: 476

Modified:
   RawSpeed/LJpegDecompressor.cpp
   RawSpeed/RawImageDataFloat.cpp
   RawSpeed/RawImageDataU16.cpp
Log:
Check at few minor memory allocations.

Modified: RawSpeed/LJpegDecompressor.cpp
===================================================================
--- RawSpeed/LJpegDecompressor.cpp      2012-10-08 06:00:34 UTC (rev 475)
+++ RawSpeed/LJpegDecompressor.cpp      2012-10-08 18:46:57 UTC (rev 476)
@@ -468,6 +468,8 @@
   uint32 l;
 
   htbl->bigTable = (int*)_aligned_malloc(size * sizeof(int), 16);
+  if (!htbl->bigTable)
+       ThrowRDE("Out of memory, failed to allocate %d bytes", 
size*sizeof(int));
   for (uint32 i = 0; i < size; i++) {
     ushort16 input = i << 2; // Calculate input value
     int code = input >> 8;   // Get 8 bits

Modified: RawSpeed/RawImageDataFloat.cpp
===================================================================
--- RawSpeed/RawImageDataFloat.cpp      2012-10-08 06:00:34 UTC (rev 475)
+++ RawSpeed/RawImageDataFloat.cpp      2012-10-08 18:46:57 UTC (rev 476)
@@ -168,6 +168,9 @@
       __m128i ssesub2;
       __m128i ssesign;
       uint32* sub_mul = (uint32*)_aligned_malloc(16*4*2, 16);
+         if (!sub_mul)
+               ThrowRDE("Out of memory, failed to allocate 128 bytes");
+
       uint32 gw = pitch / 16;
       // 10 bit fraction
       uint32 mul = (int)(1024.0f * 65535.0f / (float)(whitePoint - 
blackLevelSeparate[mOffset.x&1]));  

Modified: RawSpeed/RawImageDataU16.cpp
===================================================================
--- RawSpeed/RawImageDataU16.cpp        2012-10-08 06:00:34 UTC (rev 475)
+++ RawSpeed/RawImageDataU16.cpp        2012-10-08 18:46:57 UTC (rev 476)
@@ -187,6 +187,8 @@
     __m128i ssesub2;
     __m128i ssesign;
     uint32* sub_mul = (uint32*)_aligned_malloc(16*4*2, 16);
+    if (!sub_mul)
+         ThrowRDE("Out of memory, failed to allocate 128 bytes");
     uint32 gw = pitch / 16;
     // 10 bit fraction
     uint32 mul = (int)(1024.0f * 65535.0f / (float)(whitePoint - 
blackLevelSeparate[mOffset.x&1]));  


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to