From: <svn...@op...> - 2009-02-19 17:28:19
|
Author: bellmich Date: Thu Feb 19 18:28:33 2009 New Revision: 936 URL: http://libsyncml.opensync.org/changeset/936 Log: fixed error handling and reference counting of smlCredNewAuth Modified: trunk/libsyncml/sml_elements.c Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Thu Feb 19 18:27:02 2009 (r935) +++ trunk/libsyncml/sml_elements.c Thu Feb 19 18:28:33 2009 (r936) @@ -630,6 +630,8 @@ smlTrace(TRACE_ENTRY, "%s(%d, %s, %p)", __func__, type, VA_STRING(username), error); CHECK_ERROR_REF + SmlCred *cred = NULL; + if (username == NULL || !strlen(username)) { smlErrorSet(error, SML_ERROR_INTERNAL_MISCONFIGURATION, "If authentication should be used then the username must be set."); @@ -641,10 +643,11 @@ goto error; } - SmlCred *cred = smlTryMalloc0(sizeof(SmlCred), error); + cred = smlTryMalloc0(sizeof(SmlCred), error); if (!cred) goto error; + cred->refCount = 1; cred->format = SML_FORMAT_TYPE_BASE64; cred->type = type; cred->username = g_strdup(username); |