changeset 974:e0cfc88ad93a libavformat

Error path fix: close the video device on failure Original patch by Flavio Pimentel Duarte (flaviop AT land DOT ufrj DOT br)
author lucabe
date Tue, 28 Feb 2006 11:14:59 +0000
parents 136f654dfc03
children 36a69fbabcfb
files v4l2.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/v4l2.c	Sun Feb 26 13:22:32 2006 +0000
+++ b/v4l2.c	Tue Feb 28 11:14:59 2006 +0000
@@ -126,17 +126,20 @@
     if (res < 0 && errno == 515)
     {
         av_log(NULL, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but not supporting V4L2\n");
+        close(fd);
 
         return -1;
     }
     if (res < 0) {
         av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
                  strerror(errno));
+        close(fd);
 
         return -1;
     }
     if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
         av_log(NULL, AV_LOG_ERROR, "Not a video capture device\n");
+        close(fd);
 
         return -1;
     }