avcodec/jpeg2000dec: fix near null pointer dereference

Fixes Ticket2840

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/37/head
Michael Niedermayer 11 years ago
parent c666c59ac1
commit 63c0e9077e
  1. 2
      libavcodec/jpeg2000dec.c

@ -1343,6 +1343,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
{ {
int tileno, compno; int tileno, compno;
for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) { for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {
if (s->tile[tileno].comp) {
for (compno = 0; compno < s->ncomponents; compno++) { for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = s->tile[tileno].comp + compno; Jpeg2000Component *comp = s->tile[tileno].comp + compno;
Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno; Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;
@ -1351,6 +1352,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
} }
av_freep(&s->tile[tileno].comp); av_freep(&s->tile[tileno].comp);
} }
}
av_freep(&s->tile); av_freep(&s->tile);
s->numXtiles = s->numYtiles = 0; s->numXtiles = s->numYtiles = 0;
} }

Loading…
Cancel
Save