|
From: <svn...@op...> - 2009-11-02 12:03:57
|
Author: dgollub Date: Mon Nov 2 13:03:43 2009 New Revision: 5908 URL: http://www.opensync.org/changeset/5908 Log: Fixed compiler warnings/errors, with gcc optimzation. Fixed wrong refrence of OSyncError - it got dereferecd twice. Changed some signed chars and unsigned chars for xmlChar API Fixed potential memory leak of returned pointer of xmlPropGet, which needs to get freed, not only in error condition, with the xmlFree/osync_xml_free function. Modified: trunk/opensync/plugin/opensync_plugin_env.c Modified: trunk/opensync/plugin/opensync_plugin_env.c ============================================================================== --- trunk/opensync/plugin/opensync_plugin_env.c Mon Nov 2 13:01:07 2009 (r5907) +++ trunk/opensync/plugin/opensync_plugin_env.c Mon Nov 2 13:03:43 2009 (r5908) @@ -232,7 +232,8 @@ { OSyncModule *module = NULL; int version = 0; - gchar *name = NULL, *longname = NULL, *description = NULL, *command = NULL, *version_str = NULL; + gchar *name = NULL, *longname = NULL, *description = NULL, *command = NULL; + xmlChar *version_str = NULL; xmlDocPtr doc; xmlNodePtr cur; @@ -240,11 +241,14 @@ osync_assert(env); osync_assert(filename); - if (!osync_xml_open_file(&doc, &cur, filename, "ExternalPlugin", &error)) + if (!osync_xml_open_file(&doc, &cur, filename, "ExternalPlugin", error)) goto error; - version_str = xmlGetProp(cur->parent, (const xmlChar *)"version"); - if (version_str) version = atoi(version_str); + version_str = xmlGetProp(cur->parent, BAD_CAST "version"); + if (version_str) { + version = atoi((const char *) version_str); + osync_xml_free(version_str); + } for (; cur != NULL; cur = cur->next) { char *str = NULL; @@ -303,7 +307,7 @@ osync_module_unref(module); error: osync_free(name); osync_free(longname); osync_free(description); - osync_free(command); osync_free(version_str); + osync_free(command); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; } |