Ticket #1052 (closed defect: fixed)
[PATCH] sink_engine and obj_engine missing some references
| Reported by: | Graham Cobb | Owned by: | dgollub |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | OpenSync: Engine | Version: | 0.38 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
There are some missing ref/unref calls in the obj_engine and sink_engine handling. In particular, when osync_obj_engine_command calls osync_client_proxy_... functions and passes the sinkengine as the callback parameter, it does not increment the reference count on the sinkengine. If the callback is called after the sinkengine has been destroyed (which can certainly happen with my new timeout handling but I believe could happen even with the old timeout code) then a crash occurs.
The fix is to add a reference to the sinkengine if the osync_client_proxy_... call is successful and unref in the callback routine when it is called.
Also, the sink engine contains a pointer to the obj engine but does not increment the reference count on the obj engine. Thus the sinkengine can contain a pointer to a free'd obj engine.
Note that these are both exposed by the existing engine_error_get_changes_disconnect_error unit test when used with my new timeout code.
I have attached a patch, which looks correct and passes all test cases in my timeout branch. If you agree, please commit it to the trunk.
Attachments
Change History
Changed 4 years ago by Graham Cobb
- Attachment engine-refs.patch added

Patches for opensync_obj_engine.c and opensync_sink_engine.c