[FFmpeg-devel] [PATCH 2/6] lavf/concat: add file_packet_meta directive

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Aug 31 21:39:17 EEST 2021


Nicolas George:
> Andreas Rheinhardt (12021-08-31):
>> You seem to misunderstand the semantics of the AV_DICT_DONT_STRDUP_*
>> flags: av_dict_set() takes complete ownership of the strings, even on
>> errors. So in case of errors the above code would lead to a double-free.
>> Patches #1 and #4 of this set are also affected by this.
> 
> Thanks, I made the same mistake last time. It is counter-intuitive:
> realloc() does not free its argument if it fails, for example. Anyway,
> fixed by moving the =NULL earlier.
> 
realloc is not supposed to transfer ownership, av_dict_set() with these
flags is. For me its behaviour makes sense (and avoids lots of av_free()
on failure paths).

- Andreas


More information about the ffmpeg-devel mailing list