mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
Make v4l2_read_header() don't free a stream in case of failure when
reading its header. The stream will be freed later in av_open_input_stream(). Fix a segmentation fault due to a double free on the same pointer. Originally committed as revision 14247 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7c1d608ece
commit
deaab5fc32
@ -526,8 +526,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
capabilities = 0;
|
capabilities = 0;
|
||||||
s->fd = device_open(s1, &capabilities);
|
s->fd = device_open(s1, &capabilities);
|
||||||
if (s->fd < 0) {
|
if (s->fd < 0) {
|
||||||
av_free(st);
|
|
||||||
|
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
av_log(s1, AV_LOG_INFO, "[%d]Capabilities: %x\n", s->fd, capabilities);
|
av_log(s1, AV_LOG_INFO, "[%d]Capabilities: %x\n", s->fd, capabilities);
|
||||||
@ -553,7 +551,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
if (desired_format == 0) {
|
if (desired_format == 0) {
|
||||||
av_log(s1, AV_LOG_ERROR, "Cannot find a proper format.\n");
|
av_log(s1, AV_LOG_ERROR, "Cannot find a proper format.\n");
|
||||||
close(s->fd);
|
close(s->fd);
|
||||||
av_free(st);
|
|
||||||
|
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
@ -576,7 +573,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
}
|
}
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
close(s->fd);
|
close(s->fd);
|
||||||
av_free(st);
|
|
||||||
|
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user