]> git.sesse.net Git - ffmpeg/blobdiff - ffprobe.c
qt-faststart: Avoid leaking memory if encountering a file with double ftyp atoms
[ffmpeg] / ffprobe.c
index b3d45171ac1c348e0e71de4c6751a78768a477b6..7cb6167b05a2af25c137a099990c644893c5732a 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -155,14 +155,16 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
             printf("width=%d\n",                   dec_ctx->width);
             printf("height=%d\n",                  dec_ctx->height);
             printf("has_b_frames=%d\n",            dec_ctx->has_b_frames);
-            printf("sample_aspect_ratio=%d:%d\n",  dec_ctx->sample_aspect_ratio.num,
-                                                   dec_ctx->sample_aspect_ratio.den);
-            av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
-                      dec_ctx->width*dec_ctx->sample_aspect_ratio.num,
-                      dec_ctx->height*dec_ctx->sample_aspect_ratio.den,
-                      1024*1024);
-            printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num,
-                                                   display_aspect_ratio.den);
+            if (dec_ctx->sample_aspect_ratio.num) {
+                printf("sample_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num,
+                                                      dec_ctx->sample_aspect_ratio.den);
+                av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
+                          dec_ctx->width  * dec_ctx->sample_aspect_ratio.num,
+                          dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
+                          1024*1024);
+                printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num,
+                                                       display_aspect_ratio.den);
+            }
             printf("pix_fmt=%s\n",                 dec_ctx->pix_fmt != PIX_FMT_NONE ?
                    av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown");
             break;