libavcodec/libtwolame: fix null pointer dereference
authorPaul B Mahol <onemda@gmail.com>
Mon, 13 Oct 2014 12:22:41 +0000 (12:22 +0000)
committerPaul B Mahol <onemda@gmail.com>
Mon, 13 Oct 2014 12:22:41 +0000 (12:22 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/libtwolame.c

index e26454b..098196b 100644 (file)
@@ -152,8 +152,8 @@ static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     if (ret < 0)  // twolame error
         return AVERROR_UNKNOWN;
 
-    avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
     if (frame) {
+        avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
         if (frame->pts != AV_NOPTS_VALUE)
             avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
     } else {