Ticket #1052 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

[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

engine-refs.patch (4.1 KB) - added by Graham Cobb 6 years ago.
Patches for opensync_obj_engine.c and opensync_sink_engine.c

Change History

Changed 6 years ago by Graham Cobb

Patches for opensync_obj_engine.c and opensync_sink_engine.c

comment:1 Changed 6 years ago by felixmoeller

  • Summary changed from sink_engine and obj_engine missing some references to [PATCH] sink_engine and obj_engine missing some references

comment:2 Changed 6 years ago by Graham Cobb

  • Status changed from new to closed
  • Resolution set to fixed

This patch was committed as part of the timeout merge: r5256

Note: See TracTickets for help on using tickets.