summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavutil/internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 1012f1c690..2dfcc76624 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -249,6 +249,15 @@ if((y)<(x)){\
#define perror please_use_av_log_instead_of_perror
#endif
+#define CHECKED_ALLOC(p, size)\
+{\
+ p= av_malloc(size);\
+ if(p==NULL && (size)!=0){\
+ av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\
+ goto fail;\
+ }\
+}
+
#define CHECKED_ALLOCZ(p, size)\
{\
p= av_mallocz(size);\