Re: [evolution-patches] [calendar-gw] fix for 314925



On Sat, 2005-09-10 at 02:41 -0400, Chakravarthi(Chakravarthi P) wrote:
> On Fri, 2005-09-09 at 21:19 +0000, chenthill(P Chenthill) wrote:
> > The memory need not be duped and it is also not freed causing a memory
> > leak. 
> 
> The memory needs to be duped as 
> 1) the char * pointers returned by the icalparameter_get functions are
>    internal to the elements in struct attendee.
They are internal to the icalcomponent.
> 2) we free the struct attendee in set_attendee_list.
> 3) Again we free these pointers in e_cal_component_free_attendee_list ()
>    making it double free.
> There fore, building a list of ECalComponentAttendee items *should not*
> include pointers from the existing list of struct attendees(that is 
> attached to the priv->icalcomp )
Hmm, the double free is not due to this. They are freed while removing
the attendee property from the icalcomponent in set_attendee_list.

> 
> Regarding freeing this new memory:
> 
> The memory *is* freed by calling e_cal_component_free_attendee_list () 
> whenever a e_cal_component_set_attendee_list is called with a list of 
> ECalComponentAttendee items. Though it is not obvious that one should 
> call e_cal_component_free_attendee_list (), it is done currently at 
> every place e_cal_component_set_attendee_list () is called.
It only frees the attendee structure and not all the memory of its
elements.
> 
> 
> > The corruption is due to freeing of the priv->attendee list in the
> > set_attendee list before a new attendee property is created which needs
> > to be fixed.
> 
> I do not understand how freeing of attendee property can cause 
> corruption as we are immediately creating new attendee property and 
> attaching to the icalcomp just below in set_attedndee_list ().
> 
> IMHO, this freeing must remain as a new list of struct attendee is
> created and set to the calendar component in set_attendee_list(). The 
> old list as well as the property *should be* freed.
> 
> In fact, I forgot to g_strdup for the value property which is included
> in this patch. 
You need to reexamine the problem.
> 
> Please review.
> 
> regards
> 
> 
> > 
> > thanks, Chenthill.
> 
> 



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