mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-25 04:19:05 +00:00
Merge commit '1f64b018cbec018fa66a4a20f79958d9707913de' into release/2.4
* commit '1f64b018cbec018fa66a4a20f79958d9707913de':
nut: Make sure to clean up on read_header failure
Conflicts:
libavformat/nutdec.c
See: 361702660d
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
fb2d1b1b13
@ -744,7 +744,19 @@ fail:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nut_read_close(AVFormatContext *s);
|
static int nut_read_close(AVFormatContext *s)
|
||||||
|
{
|
||||||
|
NUTContext *nut = s->priv_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
av_freep(&nut->time_base);
|
||||||
|
av_freep(&nut->stream);
|
||||||
|
ff_nut_free_sp(nut);
|
||||||
|
for (i = 1; i < nut->header_count; i++)
|
||||||
|
av_freep(&nut->header[i]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int nut_read_header(AVFormatContext *s)
|
static int nut_read_header(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
@ -761,8 +773,7 @@ static int nut_read_header(AVFormatContext *s)
|
|||||||
pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
|
pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
|
||||||
if (pos < 0 + 1) {
|
if (pos < 0 + 1) {
|
||||||
av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
|
av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
|
||||||
ret = AVERROR_INVALIDDATA;
|
goto fail;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
} while (decode_main_header(nut) < 0);
|
} while (decode_main_header(nut) < 0);
|
||||||
|
|
||||||
@ -772,8 +783,7 @@ static int nut_read_header(AVFormatContext *s)
|
|||||||
pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
|
pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
|
||||||
if (pos < 0 + 1) {
|
if (pos < 0 + 1) {
|
||||||
av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
|
av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
|
||||||
ret = AVERROR_INVALIDDATA;
|
goto fail;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
if (decode_stream_header(nut) >= 0)
|
if (decode_stream_header(nut) >= 0)
|
||||||
initialized_stream_count++;
|
initialized_stream_count++;
|
||||||
@ -787,8 +797,7 @@ static int nut_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
if (startcode == 0) {
|
if (startcode == 0) {
|
||||||
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
|
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
|
||||||
ret = AVERROR_INVALIDDATA;
|
goto fail;
|
||||||
goto end;
|
|
||||||
} else if (startcode == SYNCPOINT_STARTCODE) {
|
} else if (startcode == SYNCPOINT_STARTCODE) {
|
||||||
nut->next_startcode = startcode;
|
nut->next_startcode = startcode;
|
||||||
break;
|
break;
|
||||||
@ -814,6 +823,10 @@ end:
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
nut_read_close(s);
|
nut_read_close(s);
|
||||||
return FFMIN(ret, 0);
|
return FFMIN(ret, 0);
|
||||||
|
fail:
|
||||||
|
nut_read_close(s);
|
||||||
|
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
|
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
|
||||||
@ -1213,20 +1226,6 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nut_read_close(AVFormatContext *s)
|
|
||||||
{
|
|
||||||
NUTContext *nut = s->priv_data;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
av_freep(&nut->time_base);
|
|
||||||
av_freep(&nut->stream);
|
|
||||||
ff_nut_free_sp(nut);
|
|
||||||
for (i = 1; i < nut->header_count; i++)
|
|
||||||
av_freep(&nut->header[i]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
AVInputFormat ff_nut_demuxer = {
|
AVInputFormat ff_nut_demuxer = {
|
||||||
.name = "nut",
|
.name = "nut",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("NUT"),
|
.long_name = NULL_IF_CONFIG_SMALL("NUT"),
|
||||||
|
Loading…
Reference in New Issue
Block a user