diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 5c7e3da0bc..cee9c01223 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -192,8 +192,10 @@ static int ogg_buffer_page(AVFormatContext *s, OGGStreamContext *oggstream) OGGPageList **p = &ogg->page_list; OGGPageList *l = av_mallocz(sizeof(*l)); - if (!l) + if (!l) { + ogg_reset_cur_page(oggstream); return AVERROR(ENOMEM); + } l->page = oggstream->page; oggstream->page.start_granule = ogg_granule_to_timestamp(oggstream, oggstream->page.granule);