[FFmpeg-devel] [PATCH 2/3] avformat/mpeg: Don't copy or leak string in AVBPrint

Michael Niedermayer michael at niedermayer.cc
Thu Dec 5 21:17:56 EET 2019


On Wed, Dec 04, 2019 at 01:37:13PM +0100, Andreas Rheinhardt wrote:
> vobsub_read_header() uses an AVBPrint to write a string and up until
> now, it collected the string stored in the AVBPrint via
> av_bprint_finalize(), which might involve an allocation and copy of the
> string. But this is unnecessary, as the lifetime of the returned string
> does not exceed the lifetime of the AVBPrint. So use the string in the
> AVBPrint directly.
> 
> This also makes it possible to easily fix a memleak: In certain error
> situations, the string stored in the AVBPrint would not be freed (if it
> was dynamically allocated). This has been fixed, too.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> Supersedes https://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252074.html
> Resending because of merge conflict.

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191205/640279c3/attachment.sig>


More information about the ffmpeg-devel mailing list