Hi,
I am trying to constify some of the "name" strings in this file. But I am running into problems caused by what seems to be an unusual use of the free() function. To my novice eye, it appears that, in functions such as get_type(), the author is trying to free strings that were not given space via malloc().
Is free() being used correctly in this file? Can I remove these calls to free()?
Thanks,
-- Andy.
On Saturday 08 July 2006 12:28, Andrew Talbot wrote:
Hi,
I am trying to constify some of the "name" strings in this file. But I am running into problems caused by what seems to be an unusual use of the free() function. To my novice eye, it appears that, in functions such as get_type(), the author is trying to free strings that were not given space via malloc().
Is free() being used correctly in this file? Can I remove these calls to free()?
I didn't look at the code in question, so what follows is just an off-the-top-of-my-head suggestion. Could those strings be implicitly allocated by yacc? You may want to look at yacc documentation -- I assume that the .y file is processed by yacc to generate a .c source. You may also look at the resultant C source to see what allocates those strings.
Cheers, Kuba
Kuba Ober wrote:
I didn't look at the code in question, so what follows is just an off-the-top-of-my-head suggestion. Could those strings be implicitly allocated by yacc? You may want to look at yacc documentation -- I assume that the .y file is processed by yacc to generate a .c source. You may also look at the resultant C source to see what allocates those strings.
Cheers, Kuba
Hi Kuba,
It believe you are correct. I shall not alter anything unless or until I know what is going on. :)
Thanks,
-- Andy.