aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-24 18:39:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-25 00:55:25 +0200
commitccecab4a0d7f3f4f296551c2e22bbf12af7d14e8 (patch)
tree8997ff2d09077d60ae4523cdac6127a4fddab89f /libavutil/mem.c
parent35cb6854bb76b4a5b6f2aea2dce81e18d7ab61cd (diff)
downloadffmpeg-ccecab4a0d7f3f4f296551c2e22bbf12af7d14e8.tar.gz
Add av_calloc() helper.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r--libavutil/mem.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 87c2008a27..44bfc8c34d 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -168,6 +168,13 @@ void *av_mallocz(size_t size)
return ptr;
}
+void *av_calloc(size_t nmemb, size_t size)
+{
+ if (size <= 0 || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_mallocz(nmemb * size);
+}
+
char *av_strdup(const char *s)
{
char *ptr= NULL;