diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-15 11:56:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-15 11:57:02 +0200 |
commit | 61b3b5872019314b1d4160456ce7cf46e3350225 (patch) | |
tree | eeee240f0e63245b89ffc207dacca0ebacece00b /libavutil/mem.h | |
parent | 81bbe49a0e588aa899f37a567808ba8926d798d6 (diff) | |
parent | 9997a812e76955b16f3a65bfe6bb6cab87e0ee56 (diff) | |
download | ffmpeg-61b3b5872019314b1d4160456ce7cf46e3350225.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mem: Document the non-compatibility of av_realloc() and av_malloc()
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r-- | libavutil/mem.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h index 37c1ec3b5e..03f7f226ae 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -107,8 +107,12 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz * reallocated. * @return Pointer to a newly-reallocated block or NULL if the block * cannot be reallocated or the function is used to free the memory block. - * @note av_realloc() is not guaranteed to maintain the alignment of - * pointers originating from the av_malloc() family of functions. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. * @see av_fast_realloc() */ void *av_realloc(void *ptr, size_t size) av_alloc_size(2); @@ -133,8 +137,12 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); * @param size Size of the single element * @return Pointer to a newly-reallocated block or NULL if the block * cannot be reallocated or the function is used to free the memory block. - * @note av_realloc_array() is not guaranteed to maintain the alignment of - * pointers originating from the av_malloc() family of functions. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. */ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); @@ -148,8 +156,12 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size) * @param nmemb Number of elements * @param size Size of the single element * @return Zero on success, an AVERROR error code on failure. - * @note av_reallocp_array() is not guaranteed to maintain the alignment of - * pointers originating from the av_malloc() family of functions. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. */ av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); |