On 29/09/14 14:14, Luca Barbato wrote:
On 29/09/14 13:36, Vittorio Giovara wrote:
On Sun, Sep 28, 2014 at 9:56 PM, Vittorio Giovara
<[email protected]> wrote:
On Sun, Sep 28, 2014 at 10:08 AM, Luca Barbato <[email protected]>
wrote:
Prevent a segfault on close.

CC: [email protected]
---

  avplay.c | 18 ++++++++++++------
  1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/avplay.c b/avplay.c
index 58da984..338a881 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1269,13 +1269,17 @@ static void alloc_picture(void *opaque)
          SDL_FreeYUVOverlay(vp->bmp);

  #if CONFIG_AVFILTER
-    vp->width   = is->out_video_filter->inputs[0]->w;
-    vp->height  = is->out_video_filter->inputs[0]->h;
-    vp->pix_fmt = is->out_video_filter->inputs[0]->format;
+    if (is->out_video_filter) {
+        vp->width   = is->out_video_filter->inputs[0]->w;
+        vp->height  = is->out_video_filter->inputs[0]->h;
+        vp->pix_fmt = is->out_video_filter->inputs[0]->format;
+    } else
  #else
-    vp->width   = is->video_st->codec->width;
-    vp->height  = is->video_st->codec->height;
-    vp->pix_fmt = is->video_st->codec->pix_fmt;
+    {
+        vp->width   = is->video_st->codec->width;
+        vp->height  = is->video_st->codec->height;
+        vp->pix_fmt = is->video_st->codec->pix_fmt;
+    }
  #endif

      vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
@@ -1660,6 +1664,8 @@ static int video_thread(void *arg)
  #if CONFIG_AVFILTER
      av_freep(&vfilters);
      avfilter_graph_free(&graph);
+    is->in_video_filter  = NULL;
+    is->out_video_filter = NULL;
  #endif
      av_free_packet(&pkt);
      av_frame_free(&frame);

I think it should be fine.

Well with the sample from 750 with the patch attached I get

Error: the video system does not support an image
size of 704x560 pixels. Try using -vf "scale=w:h"
to reduce the image size.

and then it exits, while without I can play that sample fine.


Grrr, please use asan now that you have it.

if freeying the graph frees also the filter (and it seems according to asan), it is a bug trying to use those dangling pointers.

lu

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to