[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14046] trunk/blender/source/blender/imbuf /intern/tiff.c:
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Mar 10 18:11:19 CET 2008
Revision: 14046
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14046
Author: blendix
Date: 2008-03-10 18:11:18 +0100 (Mon, 10 Mar 2008)
Log Message:
-----------
Fix for tiff 16bit saving commit, had memory leak.
Modified Paths:
--------------
trunk/blender/source/blender/imbuf/intern/tiff.c
Modified: trunk/blender/source/blender/imbuf/intern/tiff.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/tiff.c 2008-03-10 16:59:08 UTC (rev 14045)
+++ trunk/blender/source/blender/imbuf/intern/tiff.c 2008-03-10 17:11:18 UTC (rev 14046)
@@ -312,7 +312,7 @@
struct ImBuf *ibuf = NULL;
struct ImbTIFFMemFile memFile;
uint32 width, height;
- int bytesperpixel;
+ int bytesperpixel, bitspersample;
int success;
unsigned int pixel_i, byte_i;
uint32 *raster = NULL;
@@ -324,7 +324,7 @@
memFile.size = size;
/* check whether or not we have a TIFF file */
- if (size < IMB_TIFF_NCB) {
+ if (size < IMB_TIFF_NCB) {
fprintf(stderr, "imb_loadtiff: size < IMB_TIFF_NCB\n");
return NULL;
}
@@ -346,6 +346,7 @@
bytesperpixel = 4; /* 1 byte per channel, 4 channels */
libtiff_TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
libtiff_TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
+ libtiff_TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample);
ibuf = IMB_allocImBuf(width, height, 8*bytesperpixel, 0, 0);
if (ibuf) {
ibuf->ftype = TIF;
@@ -562,13 +563,15 @@
fprintf(stderr,
"imb_savetiff: Could not write encoded TIFF.\n");
libtiff_TIFFClose(image);
- libtiff__TIFFfree(pixels);
+ if(pixels) libtiff__TIFFfree(pixels);
+ if(pixels16) libtiff__TIFFfree(pixels16);
return (1);
}
/* close the TIFF file */
libtiff_TIFFClose(image);
- libtiff__TIFFfree(pixels);
+ if(pixels) libtiff__TIFFfree(pixels);
+ if(pixels16) libtiff__TIFFfree(pixels16);
return (1);
}
More information about the Bf-blender-cvs
mailing list