summaryrefslogtreecommitdiff
path: root/libavformat/avc.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-24 17:51:58 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-26 12:13:43 +0200
commita0b6df0a3953e2586e63f513485c4d2d42507d7f (patch)
tree4a5ece1da9d3798ff7063d3873300c8537ec099c /libavformat/avc.h
parent264ba34808522ac6e4753b21d6cbec60b434574a (diff)
avformat/avc, mxfenc: Avoid allocation of H264 SPS structure, fix memleak
Up until now, ff_avc_decode_sps would parse a SPS and return some properties from it in a freshly allocated structure. Yet said structure is very small and completely internal to libavformat, so there is no reason to use the heap for it. This commit therefore changes the function to return an int and to modify a caller-provided structure. This will also allow ff_avc_decode_sps to return better error codes in the future. It also fixes a memleak in mxfenc: If a packet contained multiple SPS, only the SPS structure belonging to the last SPS would be freed, the other ones would leak when the pointer is overwritten to point to the new SPS structure. Of course, without allocations there are no leaks. This is Coverity issue #1445194. Furthermore, the SPS structure has been renamed from H264SequenceParameterSet to H264SPS in order to avoid overlong lines. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/avc.h')
-rw-r--r--libavformat/avc.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/avc.h b/libavformat/avc.h
index 5286d19d89..9792b77913 100644
--- a/libavformat/avc.h
+++ b/libavformat/avc.h
@@ -46,8 +46,8 @@ typedef struct {
uint8_t bit_depth_chroma;
uint8_t frame_mbs_only_flag;
AVRational sar;
-} H264SequenceParameterSet;
+} H264SPS;
-H264SequenceParameterSet *ff_avc_decode_sps(const uint8_t *src, int src_len);
+int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size);
#endif /* AVFORMAT_AVC_H */