diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-08-29 22:38:48 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-08-29 22:38:48 +0000 |
commit | e48a0966caacd63ea77add7eeb905ef3cf2b2373 (patch) | |
tree | 604ccaab40efcbdeaf1af5eff0124de2fba9240a /libavutil/internal.h | |
parent | 6833385d30167c966a4e1cbb4d22f0ba82ef4e37 (diff) | |
download | ffmpeg-e48a0966caacd63ea77add7eeb905ef3cf2b2373.tar.gz |
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
Diffstat (limited to 'libavutil/internal.h')
-rw-r--r-- | libavutil/internal.h | 9 |
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);\ |