]> git.sesse.net Git - ffmpeg/commit
avcodec/cbs_sei: Fix leak of AVBufferRef on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 9 Mar 2021 21:11:52 +0000 (22:11 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 12 Mar 2021 22:24:31 +0000 (23:24 +0100)
commit70d226575ad8d3953e10a3233257f6e37ad35591
treebb7c1f07d3c39cb5af146c846139af6cc3eac60a
parent12a9f3fc09c7f0ded8be76d66542a88d293663cc
avcodec/cbs_sei: Fix leak of AVBufferRef on error

An AVBufferRef (and the corresponding AVBuffer and the underlying actual
buffer) would leak in ff_cbs_sei_add_message() on error in case an error
happened after its creation and before it has been attached to more
permanent storage. Fix this by only creating the AVBufferRef immediately
before attaching it to its intended target position.

(Given that no SEI message currently created is refcounted, the above
can't happen at the moment. But Coverity already nevertheless noticed:
This commit fixes Coverity issue #1473521.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/cbs_sei.c