Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2016-11-27 22:16:18 +0300
committerPhilip Langdale <philipl@overt.org>2016-12-01 00:27:43 +0300
commit5eb68520635d895bbd878abf29fdb66872cbe00e (patch)
tree9d0a1a35fabafb814dacdf550c25584e1e89ca67 /tools
parent115b834dcff0c0a3714c7251394db253d657623d (diff)
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/coverity.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/tools/coverity.c b/tools/coverity.c
index 80fc1c2ad5..3cc248c546 100644
--- a/tools/coverity.c
+++ b/tools/coverity.c
@@ -35,8 +35,30 @@
void *av_malloc(size_t size) {
int has_memory;
__coverity_negative_sink__(size);
- if(has_memory)
- return __coverity_alloc__(size);
- else
+ if (has_memory) {
+ void *ptr = __coverity_alloc__(size);
+ __coverity_mark_as_uninitialized_buffer__(ptr);
+ __coverity_mark_as_afm_allocated__(ptr, "av_free");
+ return ptr;
+ } else {
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");
}