diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-22 08:31:50 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-27 07:20:59 +0100 |
commit | de2229421ee8a79b7514e12ad66a0744f323b121 (patch) | |
tree | b1b88dde34bb5e7c37e454046ca16597eeb8e93a /libavcodec/nellymoserenc.c | |
parent | 99812e2355deac2a84025503a6429da449b7b204 (diff) | |
download | ffmpeg-de2229421ee8a79b7514e12ad66a0744f323b121.tar.gz |
avformat/wavenc: Fix leak and segfault on reallocation error
Up until now, the wav muxer used a reallocation of the form ptr =
av_realloc(ptr, size); that leaks upon error. Furthermore, if a
failed reallocation happened when writing the trailer, a segfault
would occur due to avio_write(NULL, size) because the muxer only
prints an error message upon allocation error, but does not return
the error.
Moreover setting the pointer to the buffer to NULL on error seems to
be done on purpose in order to record that an error has occured so that
outputting the peak values is no longer attempted. This behaviour has
been retained by simply disabling whether peak data should be written
if an error occurs.
Finally, the reallocation is now done once per peak block and not once
per peak block per channel; it is also done with av_fast_realloc and not
with a linear size increase.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 19ae873252c35a78b9bc1918f2878f47a1f4dc2d)
Diffstat (limited to 'libavcodec/nellymoserenc.c')
0 files changed, 0 insertions, 0 deletions