You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
tools/coverity: Add models for av_mallocz and av_free
This should deal with some false positives, but might lead to more of them depending on whether it realises that av_freep() wraps av_free() or not.
This commit is contained in:
@@ -35,8 +35,30 @@
|
|||||||
void *av_malloc(size_t size) {
|
void *av_malloc(size_t size) {
|
||||||
int has_memory;
|
int has_memory;
|
||||||
__coverity_negative_sink__(size);
|
__coverity_negative_sink__(size);
|
||||||
if(has_memory)
|
if (has_memory) {
|
||||||
return __coverity_alloc__(size);
|
void *ptr = __coverity_alloc__(size);
|
||||||
else
|
__coverity_mark_as_uninitialized_buffer__(ptr);
|
||||||
|
__coverity_mark_as_afm_allocated__(ptr, "av_free");
|
||||||
|
return ptr;
|
||||||
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *av_mallocz(size_t size) {
|
||||||
|
int has_memory;
|
||||||
|
__coverity_negative_sink__(size);
|
||||||
|
if (has_memory) {
|
||||||
|
void *ptr = __coverity_alloc__(size);
|
||||||
|
__coverity_writeall0__(ptr);
|
||||||
|
__coverity_mark_as_afm_allocated__(ptr, "av_free");
|
||||||
|
return ptr;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *av_free(void *ptr) {
|
||||||
|
__coverity_free__(ptr);
|
||||||
|
__coverity_mark_as_afm_freed__(ptr, "av_free");
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user