Resource leak fix, also cleanup.

This commit is contained in:
Lioncash 2013-02-02 01:36:53 -05:00
parent a18fbd0bcc
commit 36c82b5d18
3 changed files with 7 additions and 3 deletions

View file

@ -183,7 +183,7 @@ void mixer_mix(Mixer *mixer, short *buffer, int num_samples) {
// TODO: NEONize. Can also make special loops for left_volume == right_volume etc.
for (int s = 0; s < cnt; s++) {
int cdata = clip->data[chan->pos];
buffer[s * 2 ] += cdata * left_volume >> 8;
buffer[s * 2 + 0] += cdata * left_volume >> 8;
buffer[s * 2 + 1] += cdata * right_volume >> 8;
chan->pos++;
}

View file

@ -728,7 +728,7 @@ double calculatePSNRfile(char *srcfile, uint8 *origimg)
int active_width;
int active_height;
int format;
f=fopen(srcfile,"rb");
f=fopen(srcfile,"rb");
if(f)
{
if(ktx_mode)
@ -847,6 +847,7 @@ double calculatePSNRfile(char *srcfile, uint8 *origimg)
wPSNR = (float)(10*log((double)((255*255)/wMSE))/log((double)10));
printf("Perceptually weighted PSNR = (%f)\n",wPSNR);
fclose(f);
free(img);
return PSNR;
}

View file

@ -3032,7 +3032,10 @@ static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
skip(s, tga_palette_start );
// load the palette
tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );
if (!tga_palette) return epuc("outofmem", "Out of memory");
if (!tga_palette) {
free(tga_data);
return epuc("outofmem", "Out of memory");
}
if (!getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 )) {
free(tga_data);
free(tga_palette);