[FFmpeg-devel] [PATCH v2] lavfi/drawtext: Add localtime_ms for millisecond precision

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Feb 1 01:40:25 EET 2022


Thilo Borgmann:
> Am 31.01.22 um 14:08 schrieb Nicolas George:
>> Thilo Borgman (12022-01-31):
>>>> v10 attached.
>>>
>>> Also going to apply soon if there are no more comments.
>>
>> I think you neglected to attach the file.
> 
> omg stupid me. Here it is...
> 
> -Thilo
> 

Seems like I misunderstood your code and ignored the outer while. Your
code can leak if there are multiple 'N', because (as I said)

> 
> +
> +            if (fmt_new && fmt_new != argv[0] && fmt_new != fmt_default)
> +                av_freep(&fmt_new);
> +

does not free fmt if it is already allocated. It is possible to fix this
by adding an char *fmt_allocated = NULL; at outer scope and a fmt_new in
the block that is executed if a 'N' is executed. (You have to free
fmt_allocated immediately after av_asprintf().)
But maybe it would be best to use an AVBPrint to write the new string
instead of allocating a new string for every %N encountered.

- Andreas


More information about the ffmpeg-devel mailing list