From: <svn...@op...> - 2010-08-31 04:14:03
|
Author: cdfrey Date: Tue Aug 31 06:13:55 2010 New Revision: 6109 URL: http://www.opensync.org/changeset/6109 Log: Cleaned up cleanup code in the calendar commit function Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Tue Aug 31 06:13:44 2010 (r6108) +++ plugins/google-calendar/src/gcalendar.c Tue Aug 31 06:13:55 2010 (r6109) @@ -789,16 +789,10 @@ break; default: - osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, - "Unknown change type"); msg = "Unknown change type"; goto error; - break; } - if (updated_event) - free(updated_event); - if (event) { // update the timestamp if( plgdata->cal_timestamp ) { @@ -817,25 +811,24 @@ msg = "Failed copying contact timestamp!\n"; goto error; } - - gcal_event_delete(event); - } - // free(osync_xml); - osync_context_report_success(ctx); osync_trace(TRACE_EXIT, "%s", __func__); - return; + goto cleanup; + error: + osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, "%s", msg); + osync_trace(TRACE_EXIT, "%s:%sResult code: %d", __func__, msg, result); + +cleanup: if (updated_event) free(updated_event); + if (event) + gcal_event_delete(event); if (raw_xml) free(raw_xml); - - osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, "%s", msg); - osync_trace(TRACE_EXIT, "%s:%sHTTP code: %d", __func__, msg, result); } static void gc_commit_change_contact(OSyncObjTypeSink *sink, |