# HG changeset patch # User mru # Date 1277562855 0 # Node ID 150c7c236e78cabcda7040f75d8cdf5cd23152ab # Parent d7808ddcbceeed7820641fec16e665e40ffbb592 pcx: convert VLAs to malloc/free diff -r d7808ddcbcee -r 150c7c236e78 pcx.c --- a/pcx.c Sat Jun 26 14:34:12 2010 +0000 +++ b/pcx.c Sat Jun 26 14:34:15 2010 +0000 @@ -87,6 +87,8 @@ bytes_per_scanline; uint8_t *ptr; uint8_t const *bufstart = buf; + uint8_t *scanline; + int ret = -1; if (buf[0] != 0x0a || buf[1] > 5) { av_log(avctx, AV_LOG_ERROR, "this is not PCX encoded data\n"); @@ -154,9 +156,11 @@ ptr = p->data[0]; stride = p->linesize[0]; + scanline = av_malloc(bytes_per_scanline); + if (!scanline) + return AVERROR(ENOMEM); + if (nplanes == 3 && bits_per_pixel == 8) { - uint8_t scanline[bytes_per_scanline]; - for (y=0; ypicture; *data_size = sizeof(AVFrame); - return buf - bufstart; + ret = buf - bufstart; +end: + av_free(scanline); + return ret; } static av_cold int pcx_end(AVCodecContext *avctx) {