Opened 21 years ago

Last modified 21 years ago

#450 closed defect (fixed)

[CPL] Freeing CPL Config Options

Reported by: Daniel Morissette Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

-------- Original Message --------
Subject: [mitab] Freeing CPL Config Options
Date: Tue, 23 Dec 2003 11:55:58 +0100 (CET)
From: simon benjamin <noumayoss@yahoo.com>
Reply-To: mitab@yahoogroups.com
To: mitab@yahoogroups.com

Hi,

I wanted to override the default error handling
function provided by the mitab library (using CPL).

I defined something like this :

CPLSetConfigOption("MY_LOG","translation.log");
CPLSetErrorHandler(MyErrorHandlingFunction);

it works great... but when exiting the program, I had
to cope with memory leaks. I've searched for a few
minutes and found out that the new pair of string
"name"="value" ("MY_LOG"="transacion.log" in my case)
was not freed at the end of the execution.

I decided add a new function in the file cpl_conv.cpp
which looks like this :

void CPLFreeConfig(){
	CSLDestroy(papszConfigOptions);
}


I called it in my program and the memory leaks
disapeared !

I really don't know if I did it the right way or if it
is a bug in the cpl library. 

Has someone any idea ?

Benjamin.

Change History (3)

comment:1 by Daniel Morissette, 21 years ago

Frank,

I'll let you review and apply this fix to CPL. Once that's done, please add a
note to the associated MITAB bug:
http://bugzilla.remotesensing.org/show_bug.cgi?id=450

comment:2 by Daniel Morissette, 21 years ago

Duh... the MITAB bug is: http://www.maptools.org/bugzilla/show_bug.cgi?id=170

comment:3 by warmerdam, 21 years ago

Function added in cpl_conv.cpp and cpl_conv.h.  Also called from 
~GDALDriverManager().

Note: See TracTickets for help on using tickets.