Re: [evolution-patches] Populating backend cache with cal objects from GW server



On Thu, 2004-01-08 at 22:35 +0530, Harish Krishnaswamy wrote:
> pop_cache.diff - code to obtain the contents of 'Calendar' Folder in GW
> and populate the cache with the same. 
> This also includes code in icaltime to allow separators in ISO 8601
> strings.

Some comments below:

> +        for (l = list; l != NULL; l = g_slist_next(l)) {
> +                comp = E_CAL_COMPONENT (l);
> +		e_cal_component_get_uid (comp, &uid);
> +                rid = g_strdup (get_rid_string (comp));
> +                /* l contains e-cal-components*/
> +		e_cal_backend_cache_put_component (priv->cache, uid, rid, 
> +                                e_cal_component_get_as_string (comp));
> 
here, you are leaking the string returned by e_cal_component_get_as_string, so you should
store it in a variable, and then g_free it.

> +        subparam = soup_soap_parameter_get_first_child_by_name (param, "iCalId");
> +        if (!subparam)
> +                return NULL;
> 
here, you are also leaking the ECalComponent created some lines below (in
get_e_cal_component_from_soap_parameter). The same in the other 'return NULL' there are in
that function.

> +        dt = (ECalComponentDateTime *)g_malloc (sizeof (ECalComponentDateTime));
> ...
> +        e_cal_component_set_dtend (comp, dt);
> +        
> +        dt = (ECalComponentDateTime *)g_malloc (sizeof (ECalComponentDateTime));
> 
here, you are leaking over and over the 'dt' variable, as well as the 't' one. There is no
need to allocate the ECalComponentDateTime, just use an instance of the structure, and fill
out its fields.

> +	/* FIXME: Make this a separate function. obtain the uid for the container - 'Calendar' */
> +	msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getContainerListRequest");
> 
right, this should be an independent method, e_gw_connection_get_container_list().

> +        if (status != E_GW_CONNECTION_STATUS_OK) {
> +		g_object_unref (response);
> +		return status;
> +	}
> 
more leaks here, the 'msg' variable should also be g_object_unref'ed.

> pop_cache_libsoup - added a couple of lines to ignore Header elements
> while creating response objects.
> 
this one looks ok, please commit, with a ChangeLog entry.

cheers




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