avcodec/v4l2_m2m: Check if the file descriptor is valid before closing

Fixes ticket #9507.

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
Signed-off-by: wujian_nanjing <wujian2@huawei.com>
release/5.1
Wujian(Chin) 3 years ago committed by Steven Liu
parent bf13a177d2
commit 26e7d7b14e
  1. 3
      libavcodec/v4l2_m2m.c

@ -251,7 +251,8 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context)
ff_v4l2_context_release(&s->capture); ff_v4l2_context_release(&s->capture);
sem_destroy(&s->refsync); sem_destroy(&s->refsync);
close(s->fd); if (s->fd >= 0)
close(s->fd);
av_frame_unref(s->frame); av_frame_unref(s->frame);
av_frame_free(&s->frame); av_frame_free(&s->frame);
av_packet_unref(&s->buf_pkt); av_packet_unref(&s->buf_pkt);

Loading…
Cancel
Save