diff --git a/libavformat/utils.c b/libavformat/utils.c
index eb5549979f5b5a9588feba1fdd2663d2431cab75..8a6784a2a44cef438b39e6ca95067448d84577b0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -295,7 +295,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
 
 int av_dup_packet(AVPacket *pkt)
 {
-    if (pkt->destruct != av_destruct_packet) {
+    if (pkt->destruct != av_destruct_packet && pkt->data) {
         uint8_t *data;
         /* We duplicate the packet and don't forget to add the padding again. */
         if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)