summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-08-29 22:38:48 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-08-29 22:38:48 +0000
commite48a0966caacd63ea77add7eeb905ef3cf2b2373 (patch)
tree604ccaab40efcbdeaf1af5eff0124de2fba9240a
parent6833385d30167c966a4e1cbb4d22f0ba82ef4e37 (diff)
Add CHECKED_ALLOC macro.
It works the same as CHECKED_ALLOCZ except that it does not zero the allocated memory. Originally committed as revision 19742 to svn://svn.ffmpeg.org/ffmpeg/trunk
-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);\