The AVPacket given to an encoder's encode callback is unreferenced generically on error.
Unified · Split
| @@ -280,17 +280,14 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 279 unmodified lines | ||
| 280 | 280 | // Check if subtraction resulted in an overflow |
| 281 | 281 | if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) { |
| 282 | 282 | av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n"); |
| 283 | − av_packet_unref(avpkt); | |
| 284 | 283 | return AVERROR(EINVAL); |
| 285 | 284 | } |
| 286 | 285 | if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > 0) { |
| 287 | 286 | uint8_t* side_data = av_packet_new_side_data(avpkt, |
| 288 | 287 | AV_PKT_DATA_SKIP_SAMPLES, |
| 289 | 288 | 10); |
| 290 | − if(!side_data) { | |
| 291 | − av_packet_unref(avpkt); | |
| 289 | + if (!side_data) | |
| 292 | 290 | return AVERROR(ENOMEM); |
| 293 | − } | |
| 294 | 291 | if (!s->delay_sent) { |
| 295 | 292 | AV_WL32(side_data, avctx->initial_padding); |
| 296 | 293 | s->delay_sent = 1; |