diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-28 00:49:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-02 13:44:05 +0200 |
commit | 89b5039ff265e0519261b07aa9bdd3ed7df6090c (patch) | |
tree | 4c36ba5f31e07ef729e811b72137b0e356dc776d /libavutil/mem.c | |
parent | 663794f63da0baa059a6416d47945671dfa67462 (diff) | |
download | ffmpeg-89b5039ff265e0519261b07aa9bdd3ed7df6090c.tar.gz |
avutil/mem: add av_memdup()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r-- | libavutil/mem.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c index 687ec55875..cfa4cbd57a 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -229,6 +229,17 @@ char *av_strdup(const char *s) return ptr; } +void *av_memdup(const void *p, size_t size) +{ + void *ptr = NULL; + if (p) { + ptr = av_malloc(size); + if (ptr) + memcpy(ptr, p, size); + } + return ptr; +} + void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem) { /* see similar ffmpeg.c:grow_array() */ |