Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas026.isp.belgacom.be (localhost [127.0.0.1])
        by inav017.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k0UFb5BQ004893
        for <joris.at.lebbeke@skynet.be>; Mon, 30 Jan 2006 16:37:05 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx012.isp.belgacom.be (inmx012.isp.belgacom.be [195.238.5.90])
        by inas026.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k0UFa7xa020486
        for <joris.at.lebbeke@skynet.be>; Mon, 30 Jan 2006 16:36:58 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx012.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id k0UFZnAr009552
        for <joris.at.lebbeke@skynet.be>; Mon, 30 Jan 2006 16:35:50 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k0UFUSDF031790;
	Mon, 30 Jan 2006 10:30:44 -0500
Received: from scooby.simplesystems.org (scooby.simplesystems.org
	[65.66.246.67])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k0UFUOd8031787
	for <tiff@lists.maptools.org>; Mon, 30 Jan 2006 10:30:25 -0500
Received: from blade.simplesystems.org (blade.simplesystems.org [65.66.246.74])
	by scooby.simplesystems.org (8.12.10+Sun/8.12.10) with ESMTP id
	k0UFUKus020009; Mon, 30 Jan 2006 09:30:20 -0600 (CST)
Date: Mon, 30 Jan 2006 09:30:20 -0600 (CST)
From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
X-X-Sender: bfriesen@blade.simplesystems.org
To: Pradeep Bala <pradeepcbala@gmail.com>
Subject: Re: [Tiff] TIFFClose(var) doesnt release memory
In-Reply-To: <Pine.SOC.4.60.0601300923320.4804@blade.simplesystems.org>
Message-ID: <Pine.SOC.4.60.0601300928230.4804@blade.simplesystems.org>
References: <9b1a2a9d0601292218l224271c4ga9b7a8c78a9cf529@mail.gmail.com>
	<Pine.SOC.4.60.0601300923320.4804@blade.simplesystems.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00001205
X-MSP-STORE: Mon, 30 Jan 2006 16:37:13 +0100
Status:   

On Mon, 30 Jan 2006, Bob Friesenhahn wrote:

> On Mon, 30 Jan 2006, Pradeep Bala wrote:
>> 
>> According to the manual for TIFFClose() -- memory should be released but I
>> dont see it.., can someone point out why ?
>
> You are leaking the image returned by TIFFOpen() due to a missing 
> TIFFClose(image) before the continue statement.

Oops, my bad.  I missed the test for NULL.  Duh!

Do you have a sample of a "bad" image to test with?

What version of libtiff are you using?

Bob

>
> Bob
>
>> 
>> 
>> Thanks in advance !
>> 
>> 
>> /**** CODE FOLLOWS *****/
>> 
>> TIFF *image;
>> 
>> while( listof_files < totalfiles )
>>    {
>>            if((image = TIFFOpen(s.c_str(), "r")) == NULL)
>>            {
>>                // BAD TIFF IMAGE
>>               listof_files++;
>>                 continue;
>> 
>>            }
>>            else
>>            {
>>                // GOOD TIFF IMAGE
>>                listof_files++;
>>             }
>>              TIFFClose(image);
>> 
>>      }
>> 
>
> ======================================
> Bob Friesenhahn
> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>

======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
