From: <svn...@op...> - 2009-04-09 08:43:52
|
Author: bellmich Date: Thu Apr 9 10:43:39 2009 New Revision: 5568 URL: http://www.opensync.org/changeset/5568 Log: fixed the error handling of the ds_*_commit functions Modified: plugins/syncml/src/syncml_ds_client.c plugins/syncml/src/syncml_ds_server.c Modified: plugins/syncml/src/syncml_ds_client.c ============================================================================== --- plugins/syncml/src/syncml_ds_client.c Wed Apr 8 22:47:51 2009 (r5567) +++ plugins/syncml/src/syncml_ds_client.c Thu Apr 9 10:43:39 2009 (r5568) @@ -168,13 +168,17 @@ osync_trace(TRACE_EXIT, "%s", __func__); return; - /* FIXME: error handling must cleaned up - check context */ error: osync_error_set(&oserror, OSYNC_ERROR_GENERIC, "%s", smlErrorPrint(&error)); smlErrorDeref(&error); oserror: + if (tracer) { + osync_change_unref(change); + osync_context_unref(ctx); + safe_free((gpointer *) tracer); + } osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&oserror)); - /* report_error_on_context(&(database->commitCtx), &oserror, TRUE); */ + report_error_on_context(&ctx, &oserror, TRUE); } void ds_client_committed_all(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) Modified: plugins/syncml/src/syncml_ds_server.c ============================================================================== --- plugins/syncml/src/syncml_ds_server.c Wed Apr 8 22:47:51 2009 (r5567) +++ plugins/syncml/src/syncml_ds_server.c Thu Apr 9 10:43:39 2009 (r5568) @@ -162,13 +162,17 @@ osync_trace(TRACE_EXIT, "%s", __func__); return; - /* the context handling in case of an error is wrong */ error: osync_error_set(&oserror, OSYNC_ERROR_GENERIC, "%s", smlErrorPrint(&error)); smlErrorDeref(&error); oserror: + if (tracer) { + osync_change_unref(change); + osync_context_unref(ctx); + safe_free((gpointer *) tracer); + } osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&oserror)); - /* report_error_on_context(&(database->commitCtx), &oserror, TRUE); */ + report_error_on_context(&ctx, &oserror, TRUE); } void ds_server_committed_all(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) |