Re: [evolution-patches] patch for #60296 Calendar



On Sun, 2004-07-04 at 13:40 +0200, Rodrigo Moya wrote:
> On Thu, 2004-07-01 at 21:33 +0530, Sivaiah N wrote:
> > Hi,
> > Attached small patch fixes a crash happening when a groupwise task is
> > marked as completed . Crash is due to trying to use an uninitialized
> > variable.
> 
> > -
> > +               
> > +               cal_organizer = g_new0 (ECalComponentOrganizer, 1);
> >                 e_cal_component_get_organizer (comp, cal_organizer);
> >                 if (cal_organizer) {
> >                         organizer = g_new0 (EGwItemOrganizer, 1);
> >                         organizer->display_name = g_strdup
> > (cal_organizer->cn);
> >                         organizer->email = g_strdup (cal_organizer-
> > >value + 7);
> >                         e_gw_item_set_organizer (item, organizer);
> > +                       g_free (cal_organizer);
> >                 }
> > +               
> >         }
> you will always have to g_free the cal_organizer, since you allocated it
> previously. So, maybe it's probably better to use a
> 'ECalComponentOrganizer' struct, that is, not a pointer, and so remove
> the need to g_new0 it?

I think thats better, in concert with e_cal_component_has_organizer to
protect against bogus values.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.




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