X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpng.c;h=49c3c3d0d6a50f1bd8be2075d45026a9878d7a70;hb=631fd02d4291a5071d25d89e8991bdd3df1c3cb7;hp=f51715117343d024e6b36a4cabc8507abbc1e2ca;hpb=5956b76b28e80a49abd7409520282edc5e11dfc0;p=swftools.git diff --git a/lib/png.c b/lib/png.c index f517151..49c3c3d 100644 --- a/lib/png.c +++ b/lib/png.c @@ -545,8 +545,9 @@ int getPNG(char*sname, int*destwidth, int*destheight, unsigned char**destdata) } printf("\n");*/ } - if(data) - free(data); + if(data) { + free(data); data=0; + } } if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) { @@ -602,6 +603,7 @@ int getPNG(char*sname, int*destwidth, int*destheight, unsigned char**destdata) } } free(old); + free(imagedata); } else if(header.mode == 6 || header.mode == 2) { int i,s=0; int x,y; @@ -632,11 +634,24 @@ int getPNG(char*sname, int*destwidth, int*destheight, unsigned char**destdata) } else { old = &data2[(y-1)*header.width*4]; } - if(header.mode == 6) + if(header.mode == 6) { applyfilter4(mode, src, old, dest, header.width); - else // header.mode = 2 + } else { // header.mode = 2 applyfilter3(mode, src, old, dest, header.width); + /* replace alpha color */ + if(hasalphacolor) { + int x; + for(x=0;x