1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

jpeg2000: fix null pointer dereference in case of malloc failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2013-08-23 17:50:12 +02:00
parent 09927f3eaa
commit 9e477a3770

View File

@@ -507,17 +507,19 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno;
for (bandno = 0; bandno < reslevel->nbands; bandno++) { for (bandno = 0; bandno < reslevel->nbands; bandno++) {
Jpeg2000Band *band = reslevel->band + bandno; if (reslevel->band) {
for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) { Jpeg2000Band *band = reslevel->band + bandno;
if (band->prec) { for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) {
Jpeg2000Prec *prec = band->prec + precno; if (band->prec) {
av_freep(&prec->zerobits); Jpeg2000Prec *prec = band->prec + precno;
av_freep(&prec->cblkincl); av_freep(&prec->zerobits);
av_freep(&prec->cblk); av_freep(&prec->cblkincl);
av_freep(&prec->cblk);
}
} }
}
av_freep(&band->prec); av_freep(&band->prec);
}
} }
av_freep(&reslevel->band); av_freep(&reslevel->band);
} }