Commit e48a0966 authored by Ramiro Polla's avatar Ramiro Polla

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
parent 6833385d
...@@ -249,6 +249,15 @@ if((y)<(x)){\ ...@@ -249,6 +249,15 @@ if((y)<(x)){\
#define perror please_use_av_log_instead_of_perror #define perror please_use_av_log_instead_of_perror
#endif #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)\ #define CHECKED_ALLOCZ(p, size)\
{\ {\
p= av_mallocz(size);\ p= av_mallocz(size);\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment