Commit 778069c8 authored by Michael Niedermayer's avatar Michael Niedermayer

vorbisdec: support freeing partially allocated contexts.

Fixes null pointer derefernces
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 918b4116
...@@ -195,37 +195,41 @@ static void vorbis_free(vorbis_context *vc) ...@@ -195,37 +195,41 @@ static void vorbis_free(vorbis_context *vc)
av_freep(&vc->channel_residues); av_freep(&vc->channel_residues);
av_freep(&vc->saved); av_freep(&vc->saved);
for (i = 0; i < vc->residue_count; i++) if (vc->residues)
av_free(vc->residues[i].classifs); for (i = 0; i < vc->residue_count; i++)
av_free(vc->residues[i].classifs);
av_freep(&vc->residues); av_freep(&vc->residues);
av_freep(&vc->modes); av_freep(&vc->modes);
ff_mdct_end(&vc->mdct[0]); ff_mdct_end(&vc->mdct[0]);
ff_mdct_end(&vc->mdct[1]); ff_mdct_end(&vc->mdct[1]);
for (i = 0; i < vc->codebook_count; ++i) { if (vc->codebooks)
av_free(vc->codebooks[i].codevectors); for (i = 0; i < vc->codebook_count; ++i) {
ff_free_vlc(&vc->codebooks[i].vlc); av_free(vc->codebooks[i].codevectors);
} ff_free_vlc(&vc->codebooks[i].vlc);
}
av_freep(&vc->codebooks); av_freep(&vc->codebooks);
for (i = 0; i < vc->floor_count; ++i) { if (vc->floors)
if (vc->floors[i].floor_type == 0) { for (i = 0; i < vc->floor_count; ++i) {
av_free(vc->floors[i].data.t0.map[0]); if (vc->floors[i].floor_type == 0) {
av_free(vc->floors[i].data.t0.map[1]); av_free(vc->floors[i].data.t0.map[0]);
av_free(vc->floors[i].data.t0.book_list); av_free(vc->floors[i].data.t0.map[1]);
av_free(vc->floors[i].data.t0.lsp); av_free(vc->floors[i].data.t0.book_list);
} else { av_free(vc->floors[i].data.t0.lsp);
av_free(vc->floors[i].data.t1.list); } else {
av_free(vc->floors[i].data.t1.list);
}
} }
}
av_freep(&vc->floors); av_freep(&vc->floors);
for (i = 0; i < vc->mapping_count; ++i) { if (vc->mappings)
av_free(vc->mappings[i].magnitude); for (i = 0; i < vc->mapping_count; ++i) {
av_free(vc->mappings[i].angle); av_free(vc->mappings[i].magnitude);
av_free(vc->mappings[i].mux); av_free(vc->mappings[i].angle);
} av_free(vc->mappings[i].mux);
}
av_freep(&vc->mappings); av_freep(&vc->mappings);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment