From: <svn...@op...> - 2009-10-05 12:38:53
|
Author: bellmich Date: Mon Oct 5 14:38:35 2009 New Revision: 1312 URL: http://libsyncml.opensync.org/changeset/1312 Log: fixed several leaking references All fixed reference counters are related to the DevInf implementation. Modified: trunk/libsyncml/parser/sml_xml_parse.c Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Mon Oct 5 14:03:10 2009 (r1311) +++ trunk/libsyncml/parser/sml_xml_parse.c Mon Oct 5 14:38:35 2009 (r1312) @@ -3075,14 +3075,17 @@ { if (!sml_dev_inf_property_add_param(property, param, error)) goto error; + g_object_unref(param); param = NULL; } if (!sml_dev_inf_ctcap_add_property(ctcap, property, error)) goto error; + g_object_unref(property); property = NULL; } if (!sml_dev_inf_add_ctcap(devinf, ctcap, error)) goto error; + g_object_unref(ctcap); ctcap = NULL; g_object_unref(ct); ct = NULL; @@ -3110,10 +3113,12 @@ { if (!sml_dev_inf_property_add_param(property, param, error)) goto error; + g_object_unref(param); param = NULL; } if (!sml_dev_inf_ctcap_add_property(ctcap, property, error)) goto error; + g_object_unref(property); property = NULL; } property = sml_dev_inf_property_new(); @@ -3180,6 +3185,7 @@ { if (!sml_dev_inf_property_add_param(property, param, error)) goto error; + g_object_unref(param); param = NULL; } param = sml_dev_inf_prop_param_new(); @@ -3205,12 +3211,24 @@ goto error; } } - if (param != NULL && !sml_dev_inf_property_add_param(property, param, error)) - goto error; - if (property != NULL && !sml_dev_inf_ctcap_add_property(ctcap, property, error)) - goto error; - if (ctcap != NULL && !sml_dev_inf_add_ctcap(devinf, ctcap, error)) - goto error; + if (param != NULL) { + if (!sml_dev_inf_property_add_param(property, param, error)) + goto error; + g_object_unref(param); + param = NULL; + } + if (property != NULL) { + if (!sml_dev_inf_ctcap_add_property(ctcap, property, error)) + goto error; + g_object_unref(property); + property = NULL; + } + if (ctcap != NULL) { + if (!sml_dev_inf_add_ctcap(devinf, ctcap, error)) + goto error; + g_object_unref(ctcap); + ctcap = NULL; + } if (ct != NULL) g_object_unref(ct); @@ -3219,6 +3237,12 @@ error: if (value != NULL) smlSafeCFree(&value); + if (param) + g_object_unref(param); + if (property) + g_object_unref(property); + if (ctcap) + g_object_unref(ctcap); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, (*error)->message); return FALSE; } @@ -3760,6 +3784,7 @@ if (!sml_dev_inf_add_data_store(devinf, datastore, error)) goto error; + g_object_unref(datastore); smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; |