Ticket #1205: opensync_xmlformat.c.diff

File opensync_xmlformat.c.diff, 728 bytes (added by scriptor, 2 years ago)
  • libopensync/opensync/xmlformat/opensync_xmlformat.c

    old new osync_bool osync_xmlformat_sort(OSyncXML 
    289289 
    290290        for(index = 0; index < xmlformat->child_count; index++) { 
    291291                cur = (OSyncXMLField *)list[index]; 
    292                 xmlAddChild(xmlDocGetRootElement(xmlformat->doc), cur->node); 
    293                          
     292                cur->node = xmlAddChild(xmlDocGetRootElement(xmlformat->doc), cur->node); 
     293                if (cur->node == NULL) { 
     294                        osync_error_set(error, OSYNC_ERROR_GENERIC, "xmlAddChild() has failed."); 
     295 
     296                        goto error; 
     297                }        
     298         
    294299                if(index < xmlformat->child_count-1) 
    295300                        cur->next = (OSyncXMLField *)list[index+1]; 
    296301                else