memory leaks when setting dtstart

Bug #1285056 reported by Charles Kerr
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qtorganizer5-eds (Ubuntu)
Fix Released
Medium
Renato Araujo Oliveira Filho

Bug Description

engine.cpp is doing something like this to save the event time:

        ECalComponentDateTime *dt = g_new0(ECalComponentDateTime, 1);
        dt->value = g_new0(struct icaltimetype, 1);
        *dt->value = icaltime_from_timet(etr.startDateTime().toTime_t(), etr.isAllDay());
        e_cal_component_set_dtstart(comp, dt);
        e_cal_component_free_datetime(dt);

e_cal_component_free_datetime() doesn't free the dt pointer. All it does is:

        g_free (dt->value);
        g_free ((gchar *) dt->tzid);
        dt->value = NULL;
        dt->tzid = NULL;

So qtorganizer5-eds is leaking those 'dt' pointers.

Really, I think neither of the heap operations are necessary here. You should be able to do something like:

        struct icaltimetype ict = icaltime_from_timet(etr.startDateTime().toTime_t(), etr.isAllDay());
        ECalComponentDateTime dt;
        dt.tzid = NULL;
        dt.value = &ict;
        e_cal_component_set_dtstart(comp, &dt);
        // all on the stack, so nothing to free

Related branches

Charles Kerr (charlesk)
Changed in qtorganizer5-eds (Ubuntu):
assignee: nobody → Renato Araujo Oliveira Filho (renatofilho)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtorganizer5-eds - 0.1.1+14.04.20140228.1-0ubuntu1

---------------
qtorganizer5-eds (0.1.1+14.04.20140228.1-0ubuntu1) trusty; urgency=low

  [ Renato Araujo Oliveira Filho ]
  * Make sure to remove the request from internal list when it get
    destroyed. (LP: #1284587)
  * Implemented support for QOrganizerItemOccurrenceFetchRequest.
  * Fixed memory leaks of ECalComponentDateTime object. (LP: #1285056)
 -- Ubuntu daily release <email address hidden> Fri, 28 Feb 2014 23:37:02 +0000

Changed in qtorganizer5-eds (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.