Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
9997a812
Commit
9997a812
authored
11 years ago
by
Diego Biurrun
Browse files
Options
Downloads
Patches
Plain Diff
mem: Document the non-compatibility of av_realloc() and av_malloc()
parent
aca25104
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavutil/mem.h
+18
-6
18 additions, 6 deletions
libavutil/mem.h
with
18 additions
and
6 deletions
libavutil/mem.h
+
18
−
6
View file @
9997a812
...
@@ -106,8 +106,12 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
...
@@ -106,8 +106,12 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
* reallocated.
* reallocated.
* @return Pointer to a newly-reallocated block or NULL if the block
* @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.
* cannot be reallocated or the function is used to free the memory block.
* @note av_realloc() is not guaranteed to maintain the alignment of
* @warning Pointers originating from the av_malloc() family of functions must
* pointers originating from the av_malloc() family of functions.
* 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()
* @see av_fast_realloc()
*/
*/
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
...
@@ -122,8 +126,12 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
...
@@ -122,8 +126,12 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
* @param size Size of the single element
* @param size Size of the single element
* @return Pointer to a newly-reallocated block or NULL if the block
* @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.
* 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
* @warning Pointers originating from the av_malloc() family of functions must
* pointers originating from the av_malloc() family of functions.
* 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
);
av_alloc_size
(
2
,
3
)
void
*
av_realloc_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
...
@@ -137,8 +145,12 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
...
@@ -137,8 +145,12 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
* @param nmemb Number of elements
* @param nmemb Number of elements
* @param size Size of the single element
* @param size Size of the single element
* @return Zero on success, an AVERROR error code on failure.
* @return Zero on success, an AVERROR error code on failure.
* @note av_reallocp_array() is not guaranteed to maintain the alignment of
* @warning Pointers originating from the av_malloc() family of functions must
* pointers originating from the av_malloc() family of functions.
* 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
);
av_alloc_size
(
2
,
3
)
int
av_reallocp_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment