projects
/
platform
/
upstream
/
libav.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6833385
)
Add CHECKED_ALLOC macro.
author
Ramiro Polla
<ramiro.polla@gmail.com>
Sat, 29 Aug 2009 22:38:48 +0000
(22:38 +0000)
committer
Ramiro Polla
<ramiro.polla@gmail.com>
Sat, 29 Aug 2009 22:38:48 +0000
(22:38 +0000)
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
libavutil/internal.h
patch
|
blob
|
history
diff --git
a/libavutil/internal.h
b/libavutil/internal.h
index
1012f1c
..
2dfcc76
100644
(file)
--- 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);\