[x265] [PATCH] CHECKED_MALLOC : Added X265_log if Malloc failed Report the ERROR Log message

Gopu Govindaswamy gopu at multicorewareinc.com
Fri Sep 20 08:21:29 CEST 2013


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1379658081 -19800
# Node ID 8831d644fa9bb931ef52db7dd8c90e08786b36fe
# Parent  99a33fc4356a7daf3b09cd5e99687fa00e23051d
CHECKED_MALLOC : Added X265_log if Malloc failed Report the ERROR Log message

diff -r 99a33fc4356a -r 8831d644fa9b source/common/common.cpp
--- a/source/common/common.cpp	Fri Sep 20 11:28:56 2013 +0530
+++ b/source/common/common.cpp	Fri Sep 20 11:51:21 2013 +0530
@@ -86,7 +86,7 @@
 
 void x265_log(x265_param_t *param, int level, const char *fmt, ...)
 {
-    if (level > param->logLevel)
+    if ( param && level > param->logLevel)
         return;
     const char *log_level;
     switch (level)
diff -r 99a33fc4356a -r 8831d644fa9b source/common/common.h
--- a/source/common/common.h	Fri Sep 20 11:28:56 2013 +0530
+++ b/source/common/common.h	Fri Sep 20 11:51:21 2013 +0530
@@ -99,8 +99,11 @@
 #define CHECKED_MALLOC(var, type, count )\
 {\
     var = (type *)X265_MALLOC(type, sizeof(type) * (count));\
-    if( !var )\
+    if (!var)\
+    {\
+        x265_log(NULL, X265_LOG_ERROR, "malloc of size %d failed\n", sizeof(type) * (count));\
         goto fail;\
+    }\
 }
 
 #define ENABLE_CYCLE_COUNTERS 0


More information about the x265-devel mailing list