shithub: openh264

Download patch

ref: 71aa533038e82442ada3181cf5a34eea7def7ee0
parent: 6a0f0811aec765ba32a805c519868d59c794b947
author: sijchen <sijchen@cisco.com>
date: Fri Feb 12 10:22:22 EST 2016

move the printing of MEMORY_CHECK part to more reasonable

--- a/codec/common/src/memory_align.cpp
+++ b/codec/common/src/memory_align.cpp
@@ -70,6 +70,9 @@
   const uint32_t kiPayloadSize          = kuiSize;
 
   uint8_t* pBuf = (uint8_t*) malloc (kiActualRequestedSize);
+  if (NULL == pBuf)
+    return NULL;
+
 #ifdef MEMORY_CHECK
   if (fpMemChkPoint == NULL) {
     fpMemChkPoint    = fopen ("./enc_mem_check_point.txt",  "at+");
@@ -87,10 +90,6 @@
   }
 #endif
   uint8_t* pAlignedBuffer;
-
-  if (NULL == pBuf)
-    return NULL;
-
   pAlignedBuffer = pBuf + kiAlignedBytes + kiSizeOfVoidPointer + kiSizeOfInt;
   pAlignedBuffer -= ((uintptr_t) pAlignedBuffer & kiAlignedBytes);
   * ((void**) (pAlignedBuffer - kiSizeOfVoidPointer)) = pBuf;