diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-10-05 00:09:45 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-10-16 22:04:18 +0100 |
commit | f6912cc3e7569a94159565f553159f6c1b7e0d2c (patch) | |
tree | 04c66f883e3469a27ac2be95cf3c981ba08b577f | |
parent | b2adc3169705824a8ed941eb2654f7acee2397ba (diff) | |
download | ffmpeg-f6912cc3e7569a94159565f553159f6c1b7e0d2c.tar.gz |
trace_headers: Fix memory leaks on syntax read failures
-rw-r--r-- | libavcodec/trace_headers_bsf.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c index 94a3ef72a2..8322229d4c 100644 --- a/libavcodec/trace_headers_bsf.c +++ b/libavcodec/trace_headers_bsf.c @@ -49,15 +49,11 @@ static int trace_headers_init(AVBSFContext *bsf) av_log(bsf, AV_LOG_INFO, "Extradata\n"); err = ff_cbs_read_extradata(ctx->cbc, &ps, bsf->par_in); - if (err < 0) { - av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n"); - return err; - } ff_cbs_fragment_uninit(ctx->cbc, &ps); } - return 0; + return err; } static void trace_headers_close(AVBSFContext *bsf) @@ -97,14 +93,12 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp); err = ff_cbs_read_packet(ctx->cbc, &au, pkt); - if (err < 0) { - av_packet_unref(pkt); - return err; - } ff_cbs_fragment_uninit(ctx->cbc, &au); - return 0; + if (err < 0) + av_packet_unref(pkt); + return err; } const AVBitStreamFilter ff_trace_headers_bsf = { |