diff --git a/libavformat/utils.c b/libavformat/utils.c
index 64be7c8700fbcde0cba39b6a7fa1a241abc7a573..9dd58cc1528cdc277d6a2499ed17e91d2b48daa7 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -671,6 +671,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
         }
 
+        pkt->data = NULL;
+        pkt->size = 0;
         av_init_packet(pkt);
         ret= s->iformat->read_packet(s, pkt);
         if (ret < 0) {