We do not memcpy the avpacket buffer even if we do change it,
completely steal the buffer by resetting the avpacket.
This will prevent unexpected results due reuse or unexpected failures
due early calls to av_free_packet.
---
The alternative of freeing the packet after the frame gives us possible double
free issues I'm afraid.
libavcodec/rawdec.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index a9884e6..d0a59dc 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -196,6 +196,9 @@ static int raw_decode(AVCodecContext *avctx,
}
*data_size = sizeof(AVPicture);
+ // Reset the packet, we stole the data.
+ avpkt->data = NULL;
+ avpkt->size = 0;
return buf_size;
}
--
1.7.8.rc1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel