# HG changeset patch # User ramiro # Date 1251585528 0 # Node ID 988be4b2fd0c3d7ef31e28ed774c1da3b3d52c92 # Parent c2556eaf12caf762713bea35734f51cd668202cf Add CHECKED_ALLOC macro. It works the same as CHECKED_ALLOCZ except that it does not zero the allocated memory. diff -r c2556eaf12ca -r 988be4b2fd0c internal.h --- a/internal.h Mon Aug 17 00:15:53 2009 +0000 +++ b/internal.h Sat Aug 29 22:38:48 2009 +0000 @@ -249,6 +249,15 @@ #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);\