Fix a another memory leak in etctool.

imgdec = (unsigned char*) malloc(expandedwidth*expandedheight*3);
is called before the if statement "if((f=fopen(dstfile,"wb")))"

If the file 'f' failed in the if statement, it would never be freed (since "free(imgdec)" was within that if block.
This commit is contained in:
Lioncash 2013-02-02 13:18:23 -05:00
parent 5b5eec793f
commit 366de9f248

View file

@ -612,9 +612,10 @@ void compressImageFile(uint8 *img,int width,int height,char *dstfile, int expand
printf("\n");
fclose(f);
free(imgdec);
printf("Saved file <%s>.\n",dstfile);
printf("Saved file <%s>.\n",dstfile);
}
free(imgdec);
}
double calculatePSNR(uint8 *lossyimg, uint8 *origimg, int width, int height)