confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Confuse-devel] libConfuse issues and questions


From: Martin Hedenfalk
Subject: Re: [Confuse-devel] libConfuse issues and questions
Date: Tue, 8 Jul 2003 12:36:08 +0200

On Tue, 08 Jul 2003 02:03:16 -0500
"James Haley" <address@hidden> wrote:

> Hello,

Hi!

> I have applied libConfuse to the parsing of some game data files for
> my DOOM source
> modification project, and I have been largely pleased with the
> results. During my work
> customizing the library for use with my program, I found a couple of
> issues:
> 
> 1. It appears that even in v2.0, include files are not closed after
> the lexer has finished
> with them.

This has been fixed in the CVS. Thank you.

> 2. Amendments made to the function call parsing code in v2.0 deleted
> the code which
> frees the "funcopt" option variable. The result is that parameters
> begin to cascade to
> any subsequent function calls, causing those functions to throw an
> error. I easily fixed
> this by adding back a call to cfg_free_value in both states 8 and 9 of
> the main parsing
> function.

This was fixed in the CVS some time ago.

> Now, I have a question. The code I am using is actually a hybrid of
> v1.2.3 and v2.0, with
> almost all of the changes introduced in v2.0 except for list defaults,
> string parsing, and
> section overwriting. The latter is what I'd like to know about.  I'm
> not entirely certain
> which code changes are necessary to implement this, and I also have a 
> question about
> the code in cfg_setopt. It appears to me that the new section is set
> to use an already
> allocated section's values, but then these values are overwritten
> without the original
> values being freed.  Just from looking at it, it looks like a
> potentially large memory leak.

Yes, there should be a cfg_free(val->section) right after the "case
CFGT_SEC:" in cfg_setopt().

> Please let me know how I can adjust the code to allow for section 
> overwriting, and if
> there is indeed any problem with the code as it is in v2.0.  Thanks!

Yes, there are problems with v2.0. Adding the cfg_free() call above will
fix the memory leak problem for section overwriting. You might also want
to consider looking at the CVS repository for the latest fixes. Version
2.1 will be out Real Soon Now.

Thanks for your feedback / Martin

> James Haley
> Moderator, Team Eternity
> http://www.doomworld.com/eternity
> 

-- 
Martin Hedenfalk <address@hidden>
Systemutvecklare - Esplanad Business Solutions AB




reply via email to

[Prev in Thread] Current Thread [Next in Thread]