← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1285056] [NEW] memory leaks when setting dtstart

 

Public bug reported:

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

** Affects: qtorganizer5-eds (Ubuntu)
     Importance: Medium
     Assignee: Renato Araujo Oliveira Filho (renatofilho)
         Status: New

** Changed in: qtorganizer5-eds (Ubuntu)
     Assignee: (unassigned) => Renato Araujo Oliveira Filho (renatofilho)

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to qtorganizer5-eds in Ubuntu.
https://bugs.launchpad.net/bugs/1285056

Title:
  memory leaks when setting dtstart

Status in “qtorganizer5-eds” package in Ubuntu:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/qtorganizer5-eds/+bug/1285056/+subscriptions


Follow ups

References