diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 8b9300e08c..1ca78bc81c 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -248,7 +248,8 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (pass == 0) { /* now we know the total size of the packet (with the * start sequences added) */ - av_new_packet(pkt, total_length); + if ((result = av_new_packet(pkt, total_length)) < 0) + return result; dst = pkt->data; } else { assert(dst - pkt->data == total_length);