summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-11-27 10:47:53 +0100
committerAnton Khirnov <anton@khirnov.net>2023-01-04 11:48:17 +0100
commite17b609fc64bd824d12c1a4c4dfb2a54c74c8270 (patch)
tree204e08aa350cf6a44036babd2d285400f2c6c136 /libavcodec/libx264.c
parentcccd2c2179ec9f51bc0db3ab64a525a50c8024a5 (diff)
lavc/libx264: do not ignore memory allocation errors
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index f776d65588..8b4b986f12 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -468,21 +468,22 @@ static int setup_frame(AVCodecContext *ctx, const AVFrame *frame,
size_t sei_size;
ret = ff_alloc_a53_sei(frame, 0, &sei_data, &sei_size);
- if (ret < 0) {
- av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n");
- } else if (sei_data) {
+ if (ret < 0)
+ goto fail;
+
+ if (sei_data) {
pic->extra_sei.payloads = av_mallocz(sizeof(pic->extra_sei.payloads[0]));
if (pic->extra_sei.payloads == NULL) {
- av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n");
- av_free(sei_data);
- } else {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
pic->extra_sei.sei_free = av_free;
pic->extra_sei.payloads[0].payload_size = sei_size;
pic->extra_sei.payloads[0].payload = sei_data;
pic->extra_sei.num_payloads = 1;
pic->extra_sei.payloads[0].payload_type = 4;
- }
}
}