Timo Rothenpieler: > Coverity thinks av_dict_set frees the key and value parameter, because > it has the (rarely used) option to do so, and it's not smart enough to > figure out it depends on the flags parameter. > So lets provide a custom implementation that does not free them. > --- > tools/coverity.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/coverity.c b/tools/coverity.c > index 19a132a976..5e4eb19f39 100644 > --- a/tools/coverity.c > +++ b/tools/coverity.c > @@ -77,3 +77,12 @@ void *av_free(void *ptr) { > __coverity_mark_as_afm_freed__(ptr, "av_free"); > } > > +int av_dict_set(void **pm, const char *key, const char *value, int flags) { > + int has_memory; > + if (has_memory) { > + return 0; > + } else { > + return -1; > + } > +} > + > 1. Won't this lead to a use-of-uninitialized-value warning? 2. This is a trade-off, isn't it? Coverity will then think that all the cases where the AV_DICT_DONT_STRDUP_* flags are used lead to leaks, won't it? If so, this shoul be mentioned in the commit message. 3. Furthermore, this model does not actually set anything: pm is unchanged. Given that av_dict_set is the only function that actually allocates an AVDictionary, Coverity might infer that lots of AVDictionary * are in fact NULL; this might lead it to think that certain code is dead although it isn't. Is there a way we can just use the ordinary implementation of av_dict_set, but without the AV_DICT_DONT_STRDUP_* flags?
- Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".