Paul Cochrane wrote:
> On 26/08/07, chromatic <[EMAIL PROTECTED]> wrote:
>> On Sun, Aug 26, 2007 at 11:14:11AM -0700, Paul Cochrane wrote:
>>
>>> The variable ins2 is freed by the call to subst_ins() but is then
>>> later assigned to later in the if-block.  Um, this isn't a good idea
>>> is it?  The variable shouldn't be freed in subst_ins() I don't think,
>>> so shouldn't we instead have the line:
>>>
>>>                                     subst_ins(unit, ins2, tmp, 0);
>>>
>>> (where setting the argument to 0 means *not* freeing the variable).
>>>
>>> Is this the right thing to do?  Just wanted to ask the opinion of our
>>> resident gurus before I went and broke something...
>> free() takes a pointer and frees the memory pointed at.  The variable itself 
>> is
>> just a storage location for that pointer.  Maybe reusing the variable name is
>> confusing to humans, but I don't see any particular trouble for the computer
>> here.
> 
> Ok, I'll just tell the Coverity thing to ignore that particular warning.

Just curious, but could you please post the exact wording of the warning?

Thanks,
Ron

Reply via email to