Luigi Malagò | 7 Jan 04:00
Favicon

Re: C++ parser: segmentation fault using parsing a file twice


> hello to everybody,
> i'm new to flex bison and i'm experiencing a strange problem. I have 
> wirtten a C++ parser using
> flex 2.5.33-r1 and bison 2.2. I have to parse two different files, with 
> the same structure, so i decide to use the same parser twice.
> The problem is that when i parse one file OR the other everything is ok, 
> but when i parse both (no matter the order) or when i
> parse one of the two twice, i get a segmentation fault. Using gdm i 
> isolated the following code:
>
>   
>> void assoc_parser(brianBehaviors *bb) {
>>     assocparser_linenumber = 2;
>>     // sl = new assoc_list();
>>     // s = new assoc();   
>>     assoc_init();
>>     //assocdebug=1;
>>     assoc_bbehavior = bb;
>>    
>>     assoc_v = new variable();
>>     printf("ready to parse...\n");
>>     assocparse();
>>     printf("...parsing done\n");
>>     delete assoc_v;
>>
>>     assoc_cancel_memory_leaks();
>> }
>>     
I just solved the problem. The function  assoc_cancel_memory_leaks() 
(Continue reading)


Gmane