From: <svn...@op...> - 2009-10-22 20:42:56
|
Author: cdfrey Date: Thu Oct 22 22:42:43 2009 New Revision: 5888 URL: http://www.opensync.org/changeset/5888 Log: Fixed "out of memory" bug where xmlformat->child_count == 0 Modified: trunk/opensync/xmlformat/opensync_xmlformat.c Modified: trunk/opensync/xmlformat/opensync_xmlformat.c ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlformat.c Thu Oct 22 22:22:11 2009 (r5887) +++ trunk/opensync/xmlformat/opensync_xmlformat.c Thu Oct 22 22:42:43 2009 (r5888) @@ -177,6 +177,9 @@ if (!xmlfieldlist) goto error; + if (xmlformat->child_count == 0) + goto empty; /* nothing to do */ + liste = osync_try_malloc0(sizeof(OSyncXMLField *) * xmlformat->child_count, error); if (!liste) goto error; @@ -233,7 +236,7 @@ xmlFreeNode(key->node); g_free(key); g_free(liste); - + empty: osync_trace(TRACE_EXIT, "%s: %p", __func__, xmlfieldlist); return xmlfieldlist; |