[FFmpeg-cvslog] lavd/v4l2: fix error logic when enumerating standards
Stefano Sabatini
git at videolan.org
Sun Feb 10 21:04:53 CET 2013
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sun Feb 10 17:46:17 2013 +0100| [f0703b6cba655dfc215903d22980d8e39fff0349] | committer: Stefano Sabatini
lavd/v4l2: fix error logic when enumerating standards
Set ret to 0 before enumerating standards in v4l2_set_parameters(), avoid
use of uninitialized variable.
Regression introduced in 60950adc18fe145a235211e75da68ab07123fcaa.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0703b6cba655dfc215903d22980d8e39fff0349
---
libavdevice/v4l2.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 63a3abe..4c43e37 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -679,13 +679,16 @@ static int v4l2_set_parameters(AVFormatContext *s1)
if (s->standard) {
if (s->std_id) {
+ ret = 0;
av_log(s1, AV_LOG_DEBUG, "Setting standard: %s\n", s->standard);
/* set tv standard */
for (i = 0; ; i++) {
standard.index = i;
- if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0)
+ if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
ret = AVERROR(errno);
- if (ret < 0 || !av_strcasecmp(standard.name, s->standard))
+ break;
+ }
+ if (!av_strcasecmp(standard.name, s->standard))
break;
}
if (ret < 0) {
More information about the ffmpeg-cvslog
mailing list