Skip to content

Fix invalid ESource unref in on_client_connected()

Michael Catanzaro requested to merge mcatanzaro/#435-gnome-3-32 into gnome-3-32

This patch was written by Milan Crha. (I've just prepared it as a merge request.)

The problem is that on_client_connected() expects the ESource being references, but it's not. Similarly the self->clients expects the ESource being inserted is referenced, but it's not. This causes too early free of the ESource.

While reading the code, the expectation of on_client_connected() that the source_object argument is an EClient descendant (source = e_client_get_source (E_CLIENT (source_object));) is also wrong, especially when this is called before e_cal_client_connect_finish(). You should get the ESource from the argument returned by the e_cal_client_connect_finish() and only if it's not NULL. It can be NULL on error. That's yet another issue here, client = E_CAL_CLIENT (e_cal_client_connect_finish (result, &error)); - the typecast suggests that you expect always returned a non-NULL, but it can be NULL on error, as said above.

Fixes #435 (closed)

Merge request reports