Packets are not guranteed to be allocated by av_malloc().
Unified · Split
| @@ -1219,7 +1219,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, · 1218 unmodified lines | ||
| 1219 | 1219 | avpkt->size = 0; |
| 1220 | 1220 | else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) |
| 1221 | 1221 | avpkt->pts = avpkt->dts = frame->pts; |
| 1222 | − if (avpkt->data) { | |
| 1222 | + if (avpkt->data && avpkt->destruct == av_destruct_packet) { | |
| 1223 | 1223 | new_data = av_realloc(avpkt->data, |
| 1224 | 1224 | avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); |
| 1225 | 1225 | if (new_data) |