Re: [RFA] PR python/18565 - make Frame.function work for inline frames

Tom Tromey
2016-06-22T18:43:14Z

>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:

Yao> Tom Tromey <tom@tromey.com> writes:
>> TRY
>> {
>> + char *funname;
>> + enum language funlang;
>> +
>> FRAPY_REQUIRE_VALID (self, frame);
>>
>> - sym = find_pc_function (get_frame_address_in_block (frame));
>> + find_frame_funname (frame, &funname, &funlang, &sym);
>> + xfree (funname);
>> }
>> CATCH (except, RETURN_MASK_ALL)
>> {

Yao> Call xfree in CATCH block? Otherwise, patch is good to me.

I looked at this. I think it's probably better as-is.
My reasoning is that "funname" is initialized by the call to
find_frame_funname and isn't otherwise used. So, putting the free where
it appears now means that there is no gap between initialization and
free.

On the other hand if it is moved into the catch, then there have to be
two frees, one in the catch and one afterward.

So if it's ok with you, I'm inclined to leave it as-is.

Another option would be to change find_frame_funname to allow a NULL
argument here. Then this free would not be needed at all.

Let me know what you think.

Tom