Revision 09d1208c libavcodec/pngdec.c

View differences:

libavcodec/pngdec.c
387 387
    PNGDecContext * const s = avctx->priv_data;
388 388
    AVFrame *picture = data;
389 389
    AVFrame *p;
390
    uint8_t *crow_buf_base = NULL;
390 391
    uint32_t tag, length;
391 392
    int ret, crc;
392 393

  
......
527 528
                        goto fail;
528 529
                }
529 530
                /* compressed row */
530
                s->crow_buf = av_malloc(s->row_size + 1);
531
                if (!s->crow_buf)
531
                crow_buf_base = av_malloc(s->row_size + 16);
532
                if (!crow_buf_base)
532 533
                    goto fail;
534

  
535
                /* we want crow_buf+1 to be 16-byte aligned */
536
                s->crow_buf = crow_buf_base + 15;
533 537
                s->zstream.avail_out = s->crow_size;
534 538
                s->zstream.next_out = s->crow_buf;
535 539
            }
......
612 616
    ret = s->bytestream - s->bytestream_start;
613 617
 the_end:
614 618
    inflateEnd(&s->zstream);
615
    av_freep(&s->crow_buf);
619
    av_free(crow_buf_base);
620
    s->crow_buf = NULL;
616 621
    av_freep(&s->last_row);
617 622
    av_freep(&s->tmp_row);
618 623
    return ret;

Also available in: Unified diff