aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/v4l2.c
diff options
context:
space:
mode:
authorFlavio Pimentel Duarte <flaviop@land.ufrj.br>2006-02-28 11:14:59 +0000
committerLuca Abeni <lucabe72@email.it>2006-02-28 11:14:59 +0000
commit2b63c2225576b382d0425ae2fb94254255715b33 (patch)
tree2e3c0ce783faa56b201ed5225a2481fcb1dc8f3e /libavformat/v4l2.c
parent40116978de50c41b1e63ba6434f0d562cf173785 (diff)
downloadffmpeg-2b63c2225576b382d0425ae2fb94254255715b33.tar.gz
Error path fix: close the video device on failure
Original patch by Flavio Pimentel Duarte (flaviop AT land DOT ufrj DOT br) Originally committed as revision 5075 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/v4l2.c')
-rw-r--r--libavformat/v4l2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/v4l2.c b/libavformat/v4l2.c
index 4cdfc26e5e..8369dae767 100644
--- a/libavformat/v4l2.c
+++ b/libavformat/v4l2.c
@@ -126,17 +126,20 @@ static int device_open(const char *devname, uint32_t *capabilities)
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;
}