You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by gb...@apache.org on 2015/03/06 15:03:48 UTC

incubator-corinthia git commit: Change *alloc() functions to x*alloc().

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master 1fe57c303 -> f4162f658


Change *alloc() functions to x*alloc().

Add x*alloc functions:  Change all occurrences of calloc to xcalloc,
malloc to xmalloc and realloc to xrealloc.

*  DocFormats/platform/src/Wrapper.c
   (xmalloc): New function.
   (xcalloc): New function.
   (xrealloc): New function.

* DocFormats/headers/DFPlatform.h
   (xmalloc): New function prototype.
   (xcalloc): New function prototype.
   (xrealloc): New function prototype.

* Rename *alloc to x*lloc and add #include "DFPlatform.h" where
  missing in the following files:

   DocFormats/api/src/Operations.c
   DocFormats/core/tests/common/BDTTests.c
   DocFormats/core/src/common/DFTable.c
   DocFormats/core/src/css/CSS.c
   DocFormats/core/src/css/CSSParser.c
   DocFormats/core/src/css/CSSProperties.c
   DocFormats/core/src/css/CSSSheet.c
   DocFormats/core/src/css/CSSStyle.c
   DocFormats/core/src/html/DFHTDocument.c
   DocFormats/core/src/html/DFHTMLNormalization.c
   DocFormats/core/src/html/DFHTMLTables.c
   DocFormats/core/src/lib/DFArray.c
   DocFormats/core/src/lib/DFBuffer.c
   DocFormats/core/src/lib/DFCallback.c
   DocFormats/core/src/lib/DFError.c
   DocFormats/core/src/lib/DFHashTable.c
   DocFormats/core/src/lib/DFStorage.c
   DocFormats/core/src/lib/TextPackage.c
   DocFormats/core/src/xml/DFDOM.c
   DocFormats/core/src/xml/DFMarkupCompatibility.c
   DocFormats/core/src/xml/DFNameMap.c
   DocFormats/core/src/xml/DFXML.c
   DocFormats/core/tests/common/BDTTests.c
   DocFormats/filters/latex/src/HTMLToLaTeX.c
   DocFormats/filters/odf/src/ODFManifest.c
   DocFormats/filters/odf/src/ODFPackage.c
   DocFormats/filters/odf/src/ODFSheet.c
   DocFormats/filters/ooxml/src/common/OPC.c
   DocFormats/filters/ooxml/src/word/CSSClassNames.c
   DocFormats/filters/ooxml/src/word/WordCaption.c
   DocFormats/filters/ooxml/src/word/WordConverter.c
   DocFormats/filters/ooxml/src/word/WordLists.c
   DocFormats/filters/ooxml/src/word/WordNotes.c
   DocFormats/filters/ooxml/src/word/WordNumbering.c
   DocFormats/filters/ooxml/src/word/WordObjects.c
   DocFormats/filters/ooxml/src/word/WordPackage.c
   DocFormats/filters/ooxml/src/word/WordSection.c
   DocFormats/filters/ooxml/src/word/WordSheet.c
   DocFormats/filters/ooxml/src/word/WordTheme.c
   DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c
   DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c
   DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c
   DocFormats/filters/ooxml/src/word/lenses/WordTable.c
   DocFormats/platform/src/Unix.c
   DocFormats/platform/src/Win32.c


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/f4162f65
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/f4162f65
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/f4162f65

Branch: refs/heads/master
Commit: f4162f6588afbb6085e5fa138e7646583876a516
Parents: 1fe57c3
Author: Gabriela Gibson <gb...@apache.org>
Authored: Fri Mar 6 14:03:33 2015 +0000
Committer: Gabriela Gibson <gb...@apache.org>
Committed: Fri Mar 6 14:03:33 2015 +0000

----------------------------------------------------------------------
 DocFormats/api/src/Operations.c                 |  4 +--
 DocFormats/core/src/common/DFTable.c            | 13 +++++-----
 DocFormats/core/src/css/CSS.c                   |  3 ++-
 DocFormats/core/src/css/CSSParser.c             |  3 ++-
 DocFormats/core/src/css/CSSProperties.c         |  5 ++--
 DocFormats/core/src/css/CSSSheet.c              |  5 ++--
 DocFormats/core/src/css/CSSStyle.c              |  3 ++-
 DocFormats/core/src/html/DFHTDocument.c         |  2 +-
 DocFormats/core/src/html/DFHTMLNormalization.c  |  2 +-
 DocFormats/core/src/html/DFHTMLTables.c         |  5 ++--
 DocFormats/core/src/lib/DFArray.c               |  4 +--
 DocFormats/core/src/lib/DFBuffer.c              |  4 +--
 DocFormats/core/src/lib/DFCallback.c            |  3 ++-
 DocFormats/core/src/lib/DFError.c               |  2 +-
 DocFormats/core/src/lib/DFHashTable.c           |  4 +--
 DocFormats/core/src/lib/DFStorage.c             |  4 +--
 DocFormats/core/src/lib/TextPackage.c           |  8 +++---
 DocFormats/core/src/xml/DFDOM.c                 |  6 ++---
 DocFormats/core/src/xml/DFMarkupCompatibility.c |  4 +--
 DocFormats/core/src/xml/DFNameMap.c             |  8 +++---
 DocFormats/core/src/xml/DFXML.c                 |  4 +--
 DocFormats/core/tests/common/BDTTests.c         |  6 ++---
 DocFormats/filters/latex/src/HTMLToLaTeX.c      |  2 +-
 DocFormats/filters/odf/src/ODFManifest.c        |  4 +--
 DocFormats/filters/odf/src/ODFPackage.c         |  4 +--
 DocFormats/filters/odf/src/ODFSheet.c           |  5 ++--
 DocFormats/filters/ooxml/src/common/OPC.c       | 10 ++++----
 .../filters/ooxml/src/word/CSSClassNames.c      |  3 ++-
 DocFormats/filters/ooxml/src/word/WordCaption.c |  3 ++-
 .../filters/ooxml/src/word/WordConverter.c      |  2 +-
 DocFormats/filters/ooxml/src/word/WordLists.c   |  2 +-
 DocFormats/filters/ooxml/src/word/WordNotes.c   |  4 +--
 .../filters/ooxml/src/word/WordNumbering.c      |  8 +++---
 DocFormats/filters/ooxml/src/word/WordObjects.c |  3 ++-
 DocFormats/filters/ooxml/src/word/WordPackage.c |  4 +--
 DocFormats/filters/ooxml/src/word/WordSection.c |  3 ++-
 DocFormats/filters/ooxml/src/word/WordSheet.c   |  5 ++--
 DocFormats/filters/ooxml/src/word/WordTheme.c   |  2 +-
 .../ooxml/src/word/formatting/WordNumPr.c       |  4 +--
 .../ooxml/src/word/lenses/WordBookmark.c        |  5 ++--
 .../filters/ooxml/src/word/lenses/WordDrawing.c |  4 +--
 .../filters/ooxml/src/word/lenses/WordTable.c   |  2 +-
 DocFormats/headers/DFPlatform.h                 |  2 --
 DocFormats/platform/src/Unix.c                  |  2 +-
 DocFormats/platform/src/Win32.c                 |  2 +-
 DocFormats/platform/src/Wrapper.c               | 27 +++++++++-----------
 46 files changed, 112 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/api/src/Operations.c
----------------------------------------------------------------------
diff --git a/DocFormats/api/src/Operations.c b/DocFormats/api/src/Operations.c
index 156d85a..872f4c5 100644
--- a/DocFormats/api/src/Operations.c
+++ b/DocFormats/api/src/Operations.c
@@ -42,7 +42,7 @@ struct DFAbstractDocument {
 DFConcreteDocument *DFConcreteDocumentNew(DFStorage *storage)
 {
     DFConcreteDocument *concrete = 
-      (DFConcreteDocument *)calloc(1,sizeof(DFConcreteDocument));
+      (DFConcreteDocument *)xcalloc(1,sizeof(DFConcreteDocument));
     concrete->retainCount = 1;
     concrete->storage = DFStorageRetain(storage);
     return concrete;
@@ -121,7 +121,7 @@ void DFConcreteDocumentRelease(DFConcreteDocument *concrete)
 DFAbstractDocument *DFAbstractDocumentNew(DFStorage *storage)
 {
     DFAbstractDocument *abstract =
-      (DFAbstractDocument *)calloc(1,sizeof(DFAbstractDocument));
+      (DFAbstractDocument *)xcalloc(1,sizeof(DFAbstractDocument));
     abstract->retainCount = 1;
     abstract->storage = DFStorageRetain(storage);
     return abstract;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/common/DFTable.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/common/DFTable.c b/DocFormats/core/src/common/DFTable.c
index e8f3362..1038f47 100644
--- a/DocFormats/core/src/common/DFTable.c
+++ b/DocFormats/core/src/common/DFTable.c
@@ -18,6 +18,7 @@
 #include "DFTable.h"
 #include "DFDOM.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -38,7 +39,7 @@ DFTableDimensions DFTableDimensionsMake(unsigned int rows, unsigned int cols)
 
 DFCell *DFCellNew(DFNode *element, unsigned int row, unsigned int col)
 {
-    DFCell *cell = (DFCell *)calloc(1,sizeof(DFCell));
+    DFCell *cell = (DFCell *)xcalloc(1,sizeof(DFCell));
     cell->retainCount = 1;
     cell->element = element;
     cell->row = row;
@@ -70,16 +71,16 @@ void DFCellRelease(DFCell *cell)
 
 DFTable *DFTableNew(unsigned int rows, unsigned int cols)
 {
-    DFTable *table = (DFTable *)calloc(1,sizeof(DFTable));
+    DFTable *table = (DFTable *)xcalloc(1,sizeof(DFTable));
     table->retainCount = 1;
     table->rows = rows;
     table->cols = cols;
-    table->rowElements = (DFNode **)calloc(table->rows,sizeof(DFNode *));
-    table->colWidths = (double *)calloc(table->cols,sizeof(double));
+    table->rowElements = (DFNode **)xcalloc(table->rows,sizeof(DFNode *));
+    table->colWidths = (double *)xcalloc(table->cols,sizeof(double));
 
-    table->cells = (DFCell ***)calloc(rows,sizeof(DFCell **));
+    table->cells = (DFCell ***)xcalloc(rows,sizeof(DFCell **));
     for (unsigned int r = 0; r < table->rows; r++)
-        table->cells[r] = (DFCell **)calloc(cols,sizeof(DFCell *));
+        table->cells[r] = (DFCell **)xcalloc(cols,sizeof(DFCell *));
 
     return table;
 }

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/css/CSS.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/css/CSS.c b/DocFormats/core/src/css/CSS.c
index a052f10..2a249cb 100644
--- a/DocFormats/core/src/css/CSS.c
+++ b/DocFormats/core/src/css/CSS.c
@@ -24,6 +24,7 @@
 #include "DFString.h"
 #include "DFCharacterSet.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <ctype.h>
 #include <stdlib.h>
@@ -84,7 +85,7 @@ const char *ContentPartTypeString(ContentPartType type)
 
 ContentPart *ContentPartNew(ContentPartType type, const char *value, const char *arg)
 {
-    ContentPart *part = (ContentPart *)calloc(1,sizeof(ContentPart));
+    ContentPart *part = (ContentPart *)xcalloc(1,sizeof(ContentPart));
     part->retainCount = 1;
     part->type = type;
     part->value = DFStrDup(value);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/css/CSSParser.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/css/CSSParser.c b/DocFormats/core/src/css/CSSParser.c
index 9a7a4c1..a73fdcc 100644
--- a/DocFormats/core/src/css/CSSParser.c
+++ b/DocFormats/core/src/css/CSSParser.c
@@ -21,6 +21,7 @@
 #include "DFString.h"
 #include "DFCharacterSet.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
@@ -46,7 +47,7 @@ static void CSSParserSetError(CSSParser *p, const char *format, ...)
 
 CSSParser *CSSParserNew(const char *cinput)
 {
-    CSSParser *p = (CSSParser *)calloc(1,sizeof(CSSParser));
+    CSSParser *p = (CSSParser *)xcalloc(1,sizeof(CSSParser));
     if (cinput == NULL)
         cinput = "";
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/css/CSSProperties.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/css/CSSProperties.c b/DocFormats/core/src/css/CSSProperties.c
index 1a9bb3e..bbb1161 100644
--- a/DocFormats/core/src/css/CSSProperties.c
+++ b/DocFormats/core/src/css/CSSProperties.c
@@ -20,6 +20,7 @@
 #include "DFString.h"
 #include "DFHashTable.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -152,7 +153,7 @@ CSSProperties *CSSPropertiesNewWithExtra(CSSProperties *orig, const char *string
     DFHashTable *extra = CSSParseProperties(string);
     CSSExpandProperties(extra);
 
-    CSSProperties *result = (CSSProperties *)calloc(1,sizeof(CSSProperties));
+    CSSProperties *result = (CSSProperties *)xcalloc(1,sizeof(CSSProperties));
     result->retainCount = 1;
     result->hashTable = DFHashTableNew((DFCopyFunction)strdup,free);
     const char **names = DFHashTableCopyKeys(orig->hashTable);
@@ -176,7 +177,7 @@ CSSProperties *CSSPropertiesNewWithExtra(CSSProperties *orig, const char *string
 
 CSSProperties *CSSPropertiesNewWithRaw(DFHashTable *raw)
 {
-    CSSProperties *result = (CSSProperties *)calloc(1,sizeof(CSSProperties));
+    CSSProperties *result = (CSSProperties *)xcalloc(1,sizeof(CSSProperties));
     result->retainCount = 1;
 
     result->hashTable = DFHashTableNew((DFCopyFunction)strdup,free);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/css/CSSSheet.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/css/CSSSheet.c b/DocFormats/core/src/css/CSSSheet.c
index d0312aa..41bf968 100644
--- a/DocFormats/core/src/css/CSSSheet.c
+++ b/DocFormats/core/src/css/CSSSheet.c
@@ -25,6 +25,7 @@
 #include "DFHashTable.h"
 #include "DFBuffer.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -43,7 +44,7 @@ struct CSSSheet {
 
 CSSSheet *CSSSheetNew(void)
 {
-    CSSSheet *sheet = (CSSSheet *)calloc(1,sizeof(CSSSheet));
+    CSSSheet *sheet = (CSSSheet *)xcalloc(1,sizeof(CSSSheet));
     sheet->retainCount = 1;
     sheet->_styles = DFHashTableNew((DFCopyFunction)CSSStyleRetain,(DFFreeFunction)CSSStyleRelease);
     sheet->_defaultStyles = DFHashTableNew((DFCopyFunction)CSSStyleRetain,(DFFreeFunction)CSSStyleRelease);
@@ -494,7 +495,7 @@ static DFHashTable *getStylesByHeadingLevel(CSSSheet *sheet)
         CSSStyle *style = CSSSheetLookupSelector(sheet,allSelectors[i],0,0);
         if (style->headingLevel > 0) {
             int headingLevel = style->headingLevel;
-            StyleList *item = (StyleList *)calloc(1,sizeof(StyleList));
+            StyleList *item = (StyleList *)xcalloc(1,sizeof(StyleList));
             item->style = CSSStyleRetain(style);
             item->next = DFHashTableLookupInt(stylesByHeadingLevel,headingLevel);
             DFHashTableAddInt(stylesByHeadingLevel,headingLevel,item);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/css/CSSStyle.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/css/CSSStyle.c b/DocFormats/core/src/css/CSSStyle.c
index 38c59c4..083784d 100644
--- a/DocFormats/core/src/css/CSSStyle.c
+++ b/DocFormats/core/src/css/CSSStyle.c
@@ -24,6 +24,7 @@
 #include "DFHashTable.h"
 #include "DFString.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -57,7 +58,7 @@ static void ruleChanged(void *ctx, void *object, void *data)
 
 CSSStyle *CSSStyleNew(const char *selector)
 {
-    CSSStyle *style = (CSSStyle *)calloc(1,sizeof(CSSStyle));
+    CSSStyle *style = (CSSStyle *)xcalloc(1,sizeof(CSSStyle));
     style->retainCount = 1;
     CSSStyleSetSelector(style,selector);
     style->rules = DFHashTableNew((DFCopyFunction)CSSPropertiesRetain,(DFFreeFunction)CSSPropertiesRelease);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/html/DFHTDocument.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/html/DFHTDocument.c b/DocFormats/core/src/html/DFHTDocument.c
index 146b559..70aad45 100644
--- a/DocFormats/core/src/html/DFHTDocument.c
+++ b/DocFormats/core/src/html/DFHTDocument.c
@@ -106,7 +106,7 @@ static void removeSpecial(TidyDoc doc, TidyNode node)
 
 DFHTDocument *DFHTDocumentNew()
 {
-    DFHTDocument *htd = (DFHTDocument *)calloc(1,sizeof(DFHTDocument));
+    DFHTDocument *htd = (DFHTDocument *)xcalloc(1,sizeof(DFHTDocument));
     htd->doc = tidyCreate();
     tidyBufInit(&htd->errbuf);
     tidySetErrorBuffer(htd->doc,&htd->errbuf);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/html/DFHTMLNormalization.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/html/DFHTMLNormalization.c b/DocFormats/core/src/html/DFHTMLNormalization.c
index ccc7bb6..dc6d76c 100644
--- a/DocFormats/core/src/html/DFHTMLNormalization.c
+++ b/DocFormats/core/src/html/DFHTMLNormalization.c
@@ -123,7 +123,7 @@ typedef struct LeafEntry {
 static void findLeafNodes(DFNode *node, int depth, DFArray *leafEntries)
 {
     if (node->first == NULL) {
-        LeafEntry *entry = (LeafEntry *)calloc(1,sizeof(LeafEntry));
+        LeafEntry *entry = (LeafEntry *)xcalloc(1,sizeof(LeafEntry));
         entry->node = node;
         entry->depth = depth;
         DFArrayAppend(leafEntries,entry);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/html/DFHTMLTables.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/html/DFHTMLTables.c b/DocFormats/core/src/html/DFHTMLTables.c
index 5052c75..5863676 100644
--- a/DocFormats/core/src/html/DFHTMLTables.c
+++ b/DocFormats/core/src/html/DFHTMLTables.c
@@ -21,6 +21,7 @@
 #include "DFString.h"
 #include "CSSLength.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -58,7 +59,7 @@ static void getRowList(DFNode *table, RowList **listPtr)
     for (DFNode *tableChild = table->first; tableChild != NULL; tableChild = tableChild->next) {
         switch (tableChild->tag) {
             case HTML_TR: {
-                RowList *item = (RowList *)calloc(1,sizeof(RowList));
+                RowList *item = (RowList *)xcalloc(1,sizeof(RowList));
                 item->rowNode = tableChild;
                 *listPtr = item;
                 listPtr = &item->next;
@@ -69,7 +70,7 @@ static void getRowList(DFNode *table, RowList **listPtr)
             case HTML_TFOOT: {
                 for (DFNode *partChild = tableChild->first; partChild != NULL; partChild = partChild->next) {
                     if (partChild->tag == HTML_TR) {
-                        RowList *item = (RowList *)calloc(1,sizeof(RowList));
+                        RowList *item = (RowList *)xcalloc(1,sizeof(RowList));
                         item->rowNode = partChild;
                         *listPtr = item;
                         listPtr = &item->next;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFArray.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFArray.c b/DocFormats/core/src/lib/DFArray.c
index 86780d5..053a754 100644
--- a/DocFormats/core/src/lib/DFArray.c
+++ b/DocFormats/core/src/lib/DFArray.c
@@ -33,7 +33,7 @@ struct DFArray {
 
 DFArray *DFArrayNew(DFCopyFunction copy, DFFreeFunction free)
 {
-    DFArray *array = (DFArray *)calloc(1,sizeof(DFArray));
+    DFArray *array = (DFArray *)xcalloc(1,sizeof(DFArray));
     array->retainCount = 1;
     array->copyFun = copy;
     array->freeFun = free;
@@ -90,7 +90,7 @@ void DFArrayAppend(DFArray *array, void *item)
             array->alloc = 1;
         else
             array->alloc *= 2;
-        array->items = (void **)realloc(array->items,array->alloc*sizeof(void *));
+        array->items = (void **)xrealloc(array->items,array->alloc*sizeof(void *));
     }
     array->items[array->count++] = item;
 }

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFBuffer.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFBuffer.c b/DocFormats/core/src/lib/DFBuffer.c
index 5e68f60..efa50b9 100644
--- a/DocFormats/core/src/lib/DFBuffer.c
+++ b/DocFormats/core/src/lib/DFBuffer.c
@@ -33,7 +33,7 @@
 
 DFBuffer *DFBufferNew(void)
 {
-    DFBuffer *buf = (DFBuffer *)calloc(1,sizeof(DFBuffer));
+    DFBuffer *buf = (DFBuffer *)xcalloc(1,sizeof(DFBuffer));
     buf->retainCount = 1;
     buf->alloc = 1;
     buf->len = 0;
@@ -68,7 +68,7 @@ void DFStringBufferEnsureSpace(DFBuffer *buf, size_t len)
     if (buf->alloc < want) {
         while (buf->alloc < want)
             buf->alloc *= 2;
-        buf->data = (char *)realloc(buf->data,buf->alloc);
+        buf->data = (char *)xrealloc(buf->data,buf->alloc);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFCallback.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFCallback.c b/DocFormats/core/src/lib/DFCallback.c
index 4713857..d48e24d 100644
--- a/DocFormats/core/src/lib/DFCallback.c
+++ b/DocFormats/core/src/lib/DFCallback.c
@@ -17,12 +17,13 @@
 
 #include "DFCallback.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 
 void DFCallbackAdd(DFCallback **list, DFCallbackFunction fun, void *ctx)
 {
-    DFCallback *item = (DFCallback *)calloc(1,sizeof(DFCallback));
+    DFCallback *item = (DFCallback *)xcalloc(1,sizeof(DFCallback));
     item->fun = fun;
     item->ctx = ctx;
     item->next = *list;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFError.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFError.c b/DocFormats/core/src/lib/DFError.c
index 176fc29..4a716e3 100644
--- a/DocFormats/core/src/lib/DFError.c
+++ b/DocFormats/core/src/lib/DFError.c
@@ -57,7 +57,7 @@ void DFErrorVFormat(DFError **error, const char *format, va_list ap)
     }
     else {
         // Error object does not exist; create a new one
-        (*error) = (DFError *)calloc(1,sizeof(DFError));
+        (*error) = (DFError *)xcalloc(1,sizeof(DFError));
         (*error)->retainCount = 1;
         (*error)->message = message;
     }

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFHashTable.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFHashTable.c b/DocFormats/core/src/lib/DFHashTable.c
index 4be2d08..5385c3e 100644
--- a/DocFormats/core/src/lib/DFHashTable.c
+++ b/DocFormats/core/src/lib/DFHashTable.c
@@ -47,10 +47,10 @@ DFHashTable *DFHashTableNew(DFCopyFunction copy, DFFreeFunction free)
 
 DFHashTable *DFHashTableNew2(DFCopyFunction copy, DFFreeFunction free, int binsCount)
 {
-    DFHashTable *table = (DFHashTable *)calloc(1,sizeof(DFHashTable));
+    DFHashTable *table = (DFHashTable *)xcalloc(1,sizeof(DFHashTable));
     table->retainCount = 1;
     table->binsCount = binsCount;
-    table->bins = (DFHashEntry **)calloc(1,table->binsCount*sizeof(DFHashEntry *));
+    table->bins = (DFHashEntry **)xcalloc(1,table->binsCount*sizeof(DFHashEntry *));
     table->copy = copy;
     table->free = free;
     return table;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/DFStorage.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/DFStorage.c b/DocFormats/core/src/lib/DFStorage.c
index 3c76ce8..264d269 100644
--- a/DocFormats/core/src/lib/DFStorage.c
+++ b/DocFormats/core/src/lib/DFStorage.c
@@ -79,7 +79,7 @@ static int fsRead(DFStorage *storage, const char *path, void **buf, size_t *nbyt
     while (0 < (r = fread(&mem[blen],1,4096,file))) {
         balloc += r;
         blen += r;
-        mem = (char *)realloc(mem,balloc);
+        mem = (char *)xrealloc(mem,balloc);
     }
     ok = 1;
 
@@ -324,7 +324,7 @@ static char *fixPath(const char *input)
 
 static DFStorage *DFStorageNew(DFFileFormat format, const DFStorageOps *ops)
 {
-    DFStorage *storage = (DFStorage *)calloc(1,sizeof(DFStorage));
+    DFStorage *storage = (DFStorage *)xcalloc(1,sizeof(DFStorage));
     storage->retainCount = 1;
     storage->format = format;
     storage->ops = ops;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/lib/TextPackage.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/lib/TextPackage.c b/DocFormats/core/src/lib/TextPackage.c
index 6e6e0fa..ff14eb0 100644
--- a/DocFormats/core/src/lib/TextPackage.c
+++ b/DocFormats/core/src/lib/TextPackage.c
@@ -32,10 +32,10 @@
 
 static TextPackage *TextPackageNew(void)
 {
-    TextPackage *package = (TextPackage *)calloc(1,sizeof(TextPackage));
+    TextPackage *package = (TextPackage *)xcalloc(1,sizeof(TextPackage));
     package->retainCount = 1;
     package->items = DFHashTableNew((DFCopyFunction)strdup,free);
-    package->keys = (char **)calloc(1,sizeof(char *));
+    package->keys = (char **)xcalloc(1,sizeof(char *));
     return package;
 }
 
@@ -111,7 +111,7 @@ static int parsePackage(TextPackage *package, const char *string, const char *pa
             DFBufferFormat(currentValue,"%s\n",line);
         }
         else if (DFStringHasPrefix(line,"#item ")) {
-            package->keys = (char **)realloc(package->keys,(package->nkeys+2)*sizeof(char *));
+            package->keys = (char **)xrealloc(package->keys,(package->nkeys+2)*sizeof(char *));
             package->keys[package->nkeys++] = strdup(currentKey);
             package->keys[package->nkeys] = NULL;
             DFHashTableAdd(package->items,currentKey,currentValue->data);
@@ -128,7 +128,7 @@ static int parsePackage(TextPackage *package, const char *string, const char *pa
             return 0;
         }
     }
-    package->keys = (char **)realloc(package->keys,(package->nkeys+2)*sizeof(char *));
+    package->keys = (char **)xrealloc(package->keys,(package->nkeys+2)*sizeof(char *));
     package->keys[package->nkeys++] = strdup(currentKey);
     package->keys[package->nkeys] = NULL;
     DFHashTableAdd(package->items,currentKey,currentValue->data);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/xml/DFDOM.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFDOM.c b/DocFormats/core/src/xml/DFDOM.c
index bab22f4..56809c3 100644
--- a/DocFormats/core/src/xml/DFDOM.c
+++ b/DocFormats/core/src/xml/DFDOM.c
@@ -49,7 +49,7 @@ static DFNode *DocumentCreateNode(DFDocument *doc, Tag tag)
 {
     if (doc->nodesCount == doc->nodesAlloc) {
         doc->nodesAlloc *= 2;
-        doc->nodes = (DFNode **)realloc(doc->nodes,doc->nodesAlloc*sizeof(DFNode *));
+        doc->nodes = (DFNode **)xrealloc(doc->nodes,doc->nodesAlloc*sizeof(DFNode *));
     }
 
 //    Node *node = NodeNew(tag);
@@ -63,7 +63,7 @@ static DFNode *DocumentCreateNode(DFDocument *doc, Tag tag)
 
 DFDocument *DFDocumentNew(void)
 {
-    DFDocument *doc = (DFDocument *)calloc(1,sizeof(DFDocument));
+    DFDocument *doc = (DFDocument *)xcalloc(1,sizeof(DFDocument));
     doc->retainCount = 1;
     doc->allocator = DFAllocatorNew();
     doc->map = DFNameMapNew();
@@ -342,7 +342,7 @@ void DFSetAttribute(DFNode *element, Tag tag, const char *value)
     // No existing attribute with this tag - add it
     if (element->attrsCount == element->attrsAlloc) {
         element->attrsAlloc = (element->attrsAlloc == 0) ? 8 : (2*element->attrsAlloc);
-        element->attrs = (DFAttribute *)realloc(element->attrs,element->attrsAlloc*sizeof(DFAttribute));
+        element->attrs = (DFAttribute *)xrealloc(element->attrs,element->attrsAlloc*sizeof(DFAttribute));
     }
 
     element->attrs[element->attrsCount].tag = tag;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/xml/DFMarkupCompatibility.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFMarkupCompatibility.c b/DocFormats/core/src/xml/DFMarkupCompatibility.c
index 5fb087c..608fc71 100644
--- a/DocFormats/core/src/xml/DFMarkupCompatibility.c
+++ b/DocFormats/core/src/xml/DFMarkupCompatibility.c
@@ -59,7 +59,7 @@ struct DFMarkupCompatibility {
 
 DFMarkupCompatibility *DFMarkupCompatibilityNew(void)
 {
-    DFMarkupCompatibility *mc = (DFMarkupCompatibility *)calloc(1,sizeof(DFMarkupCompatibility));
+    DFMarkupCompatibility *mc = (DFMarkupCompatibility *)xcalloc(1,sizeof(DFMarkupCompatibility));
     return mc;
 }
 
@@ -73,7 +73,7 @@ void DFMarkupCompatibilityFree(DFMarkupCompatibility *mc)
 static void addDeclToRecord(MCRecord *record, NamespaceID nsId, Tag tag, MCAction action)
 {
     record->count++;
-    record->decls = (MCDecl *)realloc(record->decls,record->count*sizeof(MCDecl));
+    record->decls = (MCDecl *)xrealloc(record->decls,record->count*sizeof(MCDecl));
     record->decls[record->count-1].nsId = nsId;
     record->decls[record->count-1].tag = tag;
     record->decls[record->count-1].action = action;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/xml/DFNameMap.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFNameMap.c b/DocFormats/core/src/xml/DFNameMap.c
index f052020..f2f593e 100644
--- a/DocFormats/core/src/xml/DFNameMap.c
+++ b/DocFormats/core/src/xml/DFNameMap.c
@@ -91,7 +91,7 @@ static void DFNameHashTableAdd(DFNameHashTable *table, const char *name, const c
 
 static DFNameHashTable *DFNameHashTableNew()
 {
-    return (DFNameHashTable*)calloc(1,sizeof(DFNameHashTable));
+    return (DFNameHashTable*)xcalloc(1,sizeof(DFNameHashTable));
 }
 
 static void DFNameHashTableFree(DFNameHashTable *table)
@@ -124,7 +124,7 @@ struct DFNamespaceInfo {
 
 DFNamespaceInfo *DFNamespaceInfoNew(NamespaceID nsId, const char *URI, const char *prefix)
 {
-    DFNamespaceInfo *info = (DFNamespaceInfo *)calloc(1,sizeof(DFNamespaceInfo));
+    DFNamespaceInfo *info = (DFNamespaceInfo *)xcalloc(1,sizeof(DFNamespaceInfo));
     info->nsId = nsId;
     info->decl = (NamespaceDecl *)xmalloc(sizeof(NamespaceDecl));
     info->decl->namespaceURI = strdup(URI);
@@ -155,7 +155,7 @@ struct DFTagInfo {
 
 DFTagInfo *DFTagInfoNew(Tag tag, NamespaceID nsId, const char *localName)
 {
-    DFTagInfo *info = (DFTagInfo *)calloc(1,sizeof(DFTagInfo));
+    DFTagInfo *info = (DFTagInfo *)xcalloc(1,sizeof(DFTagInfo));
     info->tag = tag;
     info->decl = (TagDecl *)xmalloc(sizeof(TagDecl));
     info->decl->namespaceID = nsId;
@@ -195,7 +195,7 @@ struct DFNameMap {
 
 DFNameMap *DFNameMapNew(void)
 {
-    DFNameMap *map = (DFNameMap *)calloc(1,sizeof(DFNameMap));
+    DFNameMap *map = (DFNameMap *)xcalloc(1,sizeof(DFNameMap));
     map->namespacesByID = DFHashTableNew2(NULL,NULL,997);
     map->namespacesByURI = DFHashTableNew2(NULL,(DFFreeFunction)DFNamespaceInfoFree,997);
     map->tagsByID = DFHashTableNew2(NULL,(DFFreeFunction)DFTagInfoFree,997);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/src/xml/DFXML.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/src/xml/DFXML.c b/DocFormats/core/src/xml/DFXML.c
index e58fac5..3a335ae 100644
--- a/DocFormats/core/src/xml/DFXML.c
+++ b/DocFormats/core/src/xml/DFXML.c
@@ -73,7 +73,7 @@ struct DFSAXParser {
 
 DFSAXParser *DFSAXParserNew(void)
 {
-    DFSAXParser *parser = (DFSAXParser *)calloc(1,sizeof(DFSAXParser));
+    DFSAXParser *parser = (DFSAXParser *)xcalloc(1,sizeof(DFSAXParser));
     parser->document = DFDocumentNew();
     parser->parent = parser->document->docNode;
     parser->warnings = DFBufferNew();
@@ -360,7 +360,7 @@ static void findUsedNamespaces(DFDocument *doc, DFNode *node, char *used, Namesp
 static void writeNamespaceDeclarations(Serialization *serialization, DFNode *node)
 {
     NamespaceID count = DFNameMapNamespaceCount(serialization->doc->map);
-    char *used = (char *)calloc(1,count);
+    char *used = (char *)xcalloc(1,count);
     findUsedNamespaces(serialization->doc,node,used,count);
     for (NamespaceID nsId = 1; nsId < count; nsId++) { // don't write null namespace
         if (used[nsId]) {

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/core/tests/common/BDTTests.c
----------------------------------------------------------------------
diff --git a/DocFormats/core/tests/common/BDTTests.c b/DocFormats/core/tests/common/BDTTests.c
index 45879d2..5fdb8c4 100644
--- a/DocFormats/core/tests/common/BDTTests.c
+++ b/DocFormats/core/tests/common/BDTTests.c
@@ -43,7 +43,7 @@ struct ItemLens {
 
 static ItemLens *ItemLensNew(DFDocument *abstractDoc, DFDocument *concreteDoc)
 {
-    ItemLens *lens = (ItemLens *)calloc(1,sizeof(ItemLens));
+    ItemLens *lens = (ItemLens *)xcalloc(1,sizeof(ItemLens));
     lens->abstractDoc = DFDocumentRetain(abstractDoc);
     lens->concreteDoc = DFDocumentRetain(concreteDoc);
     return lens;
@@ -129,7 +129,7 @@ struct TestContainerLens {
 
 static TestContainerLens *TestContainerLensNew(DFDocument *abstractDoc, DFDocument *concreteDoc)
 {
-    TestContainerLens *lens = (TestContainerLens *)calloc(1,sizeof(TestContainerLens));
+    TestContainerLens *lens = (TestContainerLens *)xcalloc(1,sizeof(TestContainerLens));
     lens->abstractDoc = DFDocumentRetain(abstractDoc);
     lens->concreteDoc = DFDocumentRetain(concreteDoc);
     lens->itemLens = ItemLensNew(abstractDoc,concreteDoc);
@@ -392,7 +392,7 @@ static void test_move(void)
 
 static void test_remove(void)
 {
-    int *indices = (int *)malloc(utgetargc()*sizeof(int));
+    int *indices = (int *)xmalloc(utgetargc()*sizeof(int));
 
     for (int i = 0; i < utgetargc(); i++) {
         int index = atoi(utgetargv()[i]);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/latex/src/HTMLToLaTeX.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/latex/src/HTMLToLaTeX.c b/DocFormats/filters/latex/src/HTMLToLaTeX.c
index d555731..0cd0cc4 100644
--- a/DocFormats/filters/latex/src/HTMLToLaTeX.c
+++ b/DocFormats/filters/latex/src/HTMLToLaTeX.c
@@ -43,7 +43,7 @@ struct LaTeXConverter {
 
 LaTeXConverter *LaTeXConverterNew(DFDocument *htmlDoc)
 {
-    LaTeXConverter *conv = (LaTeXConverter *)calloc(1,sizeof(LaTeXConverter));
+    LaTeXConverter *conv = (LaTeXConverter *)xcalloc(1,sizeof(LaTeXConverter));
     conv->htmlDoc = DFDocumentRetain(htmlDoc);
     conv->packages = DFHashTableNew((DFCopyFunction)strdup,free);
     return conv;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/odf/src/ODFManifest.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/odf/src/ODFManifest.c b/DocFormats/filters/odf/src/ODFManifest.c
index 89b2a1f..b24c4eb 100644
--- a/DocFormats/filters/odf/src/ODFManifest.c
+++ b/DocFormats/filters/odf/src/ODFManifest.c
@@ -35,7 +35,7 @@ static void ODFManifestParse(ODFManifest *manifest)
 
 ODFManifest *ODFManifestNew(void)
 {
-    ODFManifest *manifest = (ODFManifest *)calloc(1,sizeof(ODFManifest));
+    ODFManifest *manifest = (ODFManifest *)xcalloc(1,sizeof(ODFManifest));
     manifest->retainCount = 1;
     manifest->doc = DFDocumentNewWithRoot(MF_MANIFEST);
     manifest->entriesByPath = DFHashTableNew(NULL,NULL);
@@ -44,7 +44,7 @@ ODFManifest *ODFManifestNew(void)
 
 ODFManifest *ODFManifestNewWithDoc(DFDocument *doc)
 {
-    ODFManifest *manifest = (ODFManifest *)calloc(1,sizeof(ODFManifest));
+    ODFManifest *manifest = (ODFManifest *)xcalloc(1,sizeof(ODFManifest));
     manifest->doc = DFDocumentRetain(doc);
     manifest->entriesByPath = DFHashTableNew(NULL,NULL);
     ODFManifestParse(manifest);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/odf/src/ODFPackage.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/odf/src/ODFPackage.c b/DocFormats/filters/odf/src/ODFPackage.c
index b937c1d..3507586 100644
--- a/DocFormats/filters/odf/src/ODFPackage.c
+++ b/DocFormats/filters/odf/src/ODFPackage.c
@@ -75,7 +75,7 @@ static int writeString(ODFPackage *package, const char *str, const char *filenam
 
 ODFPackage *ODFPackageOpenNew(DFStorage *storage, DFError **error)
 {
-    ODFPackage *package = (ODFPackage *)calloc(1,sizeof(ODFPackage));
+    ODFPackage *package = (ODFPackage *)xcalloc(1,sizeof(ODFPackage));
     package->retainCount = 1;
     package->storage = DFStorageRetain(storage);
 
@@ -101,7 +101,7 @@ ODFPackage *ODFPackageOpenNew(DFStorage *storage, DFError **error)
 
 ODFPackage *ODFPackageOpenFrom(DFStorage *storage, DFError **error)
 {
-    ODFPackage *package = (ODFPackage *)calloc(1,sizeof(ODFPackage));
+    ODFPackage *package = (ODFPackage *)xcalloc(1,sizeof(ODFPackage));
     package->retainCount = 1;
     package->storage = DFStorageRetain(storage);
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/odf/src/ODFSheet.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/odf/src/ODFSheet.c b/DocFormats/filters/odf/src/ODFSheet.c
index fa0188c..c2ea092 100644
--- a/DocFormats/filters/odf/src/ODFSheet.c
+++ b/DocFormats/filters/odf/src/ODFSheet.c
@@ -19,6 +19,7 @@
 #include "DFDOM.h"
 #include "DFHashTable.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <stdlib.h>
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -29,7 +30,7 @@
 
 ODFStyle *ODFStyleNew()
 {
-    ODFStyle *style = (ODFStyle *)calloc(1,sizeof(ODFStyle));
+    ODFStyle *style = (ODFStyle *)xcalloc(1,sizeof(ODFStyle));
     style->retainCount = 1;
     return style;
 }
@@ -65,7 +66,7 @@ struct ODFSheet {
 
 ODFSheet *ODFSheetNew(DFDocument *stylesDoc, DFDocument *contentDoc)
 {
-    ODFSheet *sheet = (ODFSheet *)calloc(1,sizeof(ODFSheet));
+    ODFSheet *sheet = (ODFSheet *)xcalloc(1,sizeof(ODFSheet));
     sheet->retainCount = 1;
     sheet->stylesDoc = DFDocumentRetain(stylesDoc);
     sheet->contentDoc = DFDocumentRetain(contentDoc);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/common/OPC.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/common/OPC.c b/DocFormats/filters/ooxml/src/common/OPC.c
index 999aad7..e64cca4 100644
--- a/DocFormats/filters/ooxml/src/common/OPC.c
+++ b/DocFormats/filters/ooxml/src/common/OPC.c
@@ -35,7 +35,7 @@
 
 static OPCRelationship *OPCRelationshipNew(const char *rId, const char *type, const char *target, int external)
 {
-    OPCRelationship *rel = (OPCRelationship *)calloc(1,sizeof(OPCRelationship));
+    OPCRelationship *rel = (OPCRelationship *)xcalloc(1,sizeof(OPCRelationship));
     rel->retainCount = 1;
     rel->rId = (rId != NULL) ? strdup(rId) : NULL;
     rel->type = (type != NULL) ? strdup(type) : NULL;
@@ -76,7 +76,7 @@ struct OPCRelationshipSet {
 
 OPCRelationshipSet *OPCRelationshipSetNew(void)
 {
-    OPCRelationshipSet *set = (OPCRelationshipSet *)calloc(1,sizeof(OPCRelationshipSet));
+    OPCRelationshipSet *set = (OPCRelationshipSet *)xcalloc(1,sizeof(OPCRelationshipSet));
     set->relsById = DFHashTableNew((DFCopyFunction)OPCRelationshipRetain,(DFFreeFunction)OPCRelationshipRelease);
     set->relsByType = DFHashTableNew((DFCopyFunction)OPCRelationshipRetain,(DFFreeFunction)OPCRelationshipRelease);
     set->relsByDetail = DFHashTableNew((DFCopyFunction)OPCRelationshipRetain,(DFFreeFunction)OPCRelationshipRelease);
@@ -190,7 +190,7 @@ DFDocument *OPCRelationshipSetToDocument(OPCRelationshipSet *set)
 
 OPCPart *OPCPartNew(const char *URI, const char *contentType)
 {
-    OPCPart *part = (OPCPart *)calloc(1,sizeof(OPCPart));
+    OPCPart *part = (OPCPart *)xcalloc(1,sizeof(OPCPart));
     part->retainCount = 1;
     part->URI = (URI != NULL) ? strdup(URI) : NULL;
     part->contentType = (contentType != NULL) ? strdup(contentType) : NULL;
@@ -228,7 +228,7 @@ struct OPCContentTypes {
 
 static OPCContentTypes *OPCContentTypesNew(void)
 {
-    OPCContentTypes *ct = (OPCContentTypes *)calloc(1,sizeof(OPCContentTypes));
+    OPCContentTypes *ct = (OPCContentTypes *)xcalloc(1,sizeof(OPCContentTypes));
     ct->defaultsByExtension = DFHashTableNew((DFCopyFunction)strdup,free);
     ct->overridesByPartName = DFHashTableNew((DFCopyFunction)strdup,free);
     return ct;
@@ -354,7 +354,7 @@ void OPCContentTypesRemoveOverride(OPCContentTypes *ct, const char *partName)
 
 static OPCPackage *OPCPackageNew(DFStorage *storage)
 {
-    OPCPackage *pkg = (OPCPackage *)calloc(1,sizeof(OPCPackage));
+    OPCPackage *pkg = (OPCPackage *)xcalloc(1,sizeof(OPCPackage));
     pkg->storage = DFStorageRetain(storage);
     pkg->contentTypes = OPCContentTypesNew();
     pkg->relationships = OPCRelationshipSetNew();

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/CSSClassNames.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/CSSClassNames.c b/DocFormats/filters/ooxml/src/word/CSSClassNames.c
index 7e63a6e..e7c0f2f 100644
--- a/DocFormats/filters/ooxml/src/word/CSSClassNames.c
+++ b/DocFormats/filters/ooxml/src/word/CSSClassNames.c
@@ -29,6 +29,7 @@
 #include "WordStyles.h"
 #include "Word.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <stdlib.h>
 #include <string.h>
 
@@ -270,7 +271,7 @@ static void determineReplacements(CSSSheet *styleSheet, DFHashTable *repls)
         if (className == NULL)
             className = strdup("");;
 
-        SelectorList *item = (SelectorList *)calloc(1,sizeof(SelectorList));
+        SelectorList *item = (SelectorList *)xcalloc(1,sizeof(SelectorList));
         item->selector = strdup(selector);
         item->next = DFHashTableLookup(selectorsByClassName,className);
         DFHashTableAdd(selectorsByClassName,className,item);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordCaption.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordCaption.c b/DocFormats/filters/ooxml/src/word/WordCaption.c
index a64e5f0..4ac1149 100644
--- a/DocFormats/filters/ooxml/src/word/WordCaption.c
+++ b/DocFormats/filters/ooxml/src/word/WordCaption.c
@@ -16,6 +16,7 @@
 // under the License.
 
 #include "WordCaption.h"
+#include "DFPlatform.h"
 #include "DFCommon.h"
 #include <stdlib.h>
 
@@ -27,7 +28,7 @@
 
 WordCaption *WordCaptionNew(DFNode *element)
 {
-    WordCaption *caption = (WordCaption *)calloc(1,sizeof(WordCaption));
+    WordCaption *caption = (WordCaption *)xcalloc(1,sizeof(WordCaption));
     caption->retainCount = 1;
     caption->element = element;
     return caption;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordConverter.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordConverter.c b/DocFormats/filters/ooxml/src/word/WordConverter.c
index 07de6b3..0b22f49 100644
--- a/DocFormats/filters/ooxml/src/word/WordConverter.c
+++ b/DocFormats/filters/ooxml/src/word/WordConverter.c
@@ -562,7 +562,7 @@ static void Word_postProcessHTMLDoc(WordConverter *conv)
 
 static WordConverter *WordConverterNew(DFDocument *html, DFStorage *abstractStorage, WordPackage *package)
 {
-    WordConverter *converter = (WordConverter *)calloc(1,sizeof(WordConverter));
+    WordConverter *converter = (WordConverter *)xcalloc(1,sizeof(WordConverter));
     converter->html = DFDocumentRetain(html);
     converter->abstractStorage = DFStorageRetain(abstractStorage);
     assert(DFStorageFormat(converter->abstractStorage) == DFFileFormatHTML);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordLists.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordLists.c b/DocFormats/filters/ooxml/src/word/WordLists.c
index e7381a5..018c6a0 100644
--- a/DocFormats/filters/ooxml/src/word/WordLists.c
+++ b/DocFormats/filters/ooxml/src/word/WordLists.c
@@ -57,7 +57,7 @@ struct ListFrame {
 
 ListFrame *ListFrameNew(DFNode *element, ListFrame *parent, int numId, int ilvl, ListDimensions dimensions)
 {
-    ListFrame *frame = (ListFrame *)calloc(1,sizeof(ListFrame));
+    ListFrame *frame = (ListFrame *)xcalloc(1,sizeof(ListFrame));
     frame->element = element;
     frame->parent = parent;
     frame->numId = numId;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordNotes.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordNotes.c b/DocFormats/filters/ooxml/src/word/WordNotes.c
index f222be7..2e49c83 100644
--- a/DocFormats/filters/ooxml/src/word/WordNotes.c
+++ b/DocFormats/filters/ooxml/src/word/WordNotes.c
@@ -267,7 +267,7 @@ void WordNoteReferenceRemove(struct WordPutData *put, DFNode *concrete)
 
 WordNote *WordNoteNew(DFNode *element, int noteId)
 {
-    WordNote *note = (WordNote *)calloc(1,sizeof(WordNote));
+    WordNote *note = (WordNote *)xcalloc(1,sizeof(WordNote));
     note->retainCount = 1;
     note->element = element;
     note->noteId = noteId;
@@ -316,7 +316,7 @@ static WordNoteGroup *WordNoteGroupNew(DFDocument *doc, Tag noteTag, Tag refTag,
     assert(doc != NULL);
     assert((noteTag == WORD_FOOTNOTE) || (noteTag == WORD_ENDNOTE));
 
-    WordNoteGroup *group = (WordNoteGroup *)calloc(1,sizeof(WordNoteGroup));
+    WordNoteGroup *group = (WordNoteGroup *)xcalloc(1,sizeof(WordNoteGroup));
     group->retainCount = 1;
     group->notesById = DFHashTableNew((DFCopyFunction)WordNoteRetain,(DFFreeFunction)WordNoteRelease);
     group->doc = DFDocumentRetain(doc);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordNumbering.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordNumbering.c b/DocFormats/filters/ooxml/src/word/WordNumbering.c
index ed60ca1..07fc431 100644
--- a/DocFormats/filters/ooxml/src/word/WordNumbering.c
+++ b/DocFormats/filters/ooxml/src/word/WordNumbering.c
@@ -55,7 +55,7 @@ WordNumLevel *WordNumLevelNew(DFNode *element)
     if (ilvl == NULL)
         ilvl = "0";;
 
-    WordNumLevel *level = (WordNumLevel *)calloc(1,sizeof(WordNumLevel));
+    WordNumLevel *level = (WordNumLevel *)xcalloc(1,sizeof(WordNumLevel));
 
     level->ilvl = atoi(ilvl);
     level->numFmt = (numFmt != NULL) ? strdup(numFmt) : NULL;
@@ -119,7 +119,7 @@ const char *WordNumLevelToListStyleType(WordNumLevel *level)
 
 static WordAbstractNum *WordAbstractNumNew(const char *abstractNumId1, DFNode *element1)
 {
-    WordAbstractNum *abs = (WordAbstractNum *)calloc(1,sizeof(WordAbstractNum));
+    WordAbstractNum *abs = (WordAbstractNum *)xcalloc(1,sizeof(WordAbstractNum));
     abs->abstractNumId = (abstractNumId1 != NULL) ? strdup(abstractNumId1) : NULL;
     abs->element = element1;
     abs->levels = DFHashTableNew(NULL,(DFFreeFunction)WordNumLevelFree);
@@ -151,7 +151,7 @@ WordNumLevel *WordAbstractNumGetLevel(WordAbstractNum *abs, int ilvl)
 
 static WordConcreteNum *WordConcreteNumNew(const char *numId, DFNode *element, WordAbstractNum *abstractNum)
 {
-    WordConcreteNum *con = (WordConcreteNum *)calloc(1,sizeof(WordConcreteNum));
+    WordConcreteNum *con = (WordConcreteNum *)xcalloc(1,sizeof(WordConcreteNum));
     con->numId = (numId != NULL) ? strdup(numId) : NULL;
     con->element = element;
     con->abstractNum = abstractNum;
@@ -195,7 +195,7 @@ static void WordNumberingRegisterType(WordNumbering *num, ListStyleType type, co
 
 WordNumbering *WordNumberingNew(WordPackage *package)
 {
-    WordNumbering *num = (WordNumbering *)calloc(1,sizeof(WordNumbering));
+    WordNumbering *num = (WordNumbering *)xcalloc(1,sizeof(WordNumbering));
     num->_package = WordPackageRetain(package);
     num->_abstractNums = DFHashTableNew(NULL,(DFFreeFunction)WordAbstractNumFree);
     num->_concreteNums = DFHashTableNew(NULL,(DFFreeFunction)WordConcreteNumFree);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordObjects.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordObjects.c b/DocFormats/filters/ooxml/src/word/WordObjects.c
index 543b19b..d4a9877 100644
--- a/DocFormats/filters/ooxml/src/word/WordObjects.c
+++ b/DocFormats/filters/ooxml/src/word/WordObjects.c
@@ -24,6 +24,7 @@
 #include "DFString.h"
 #include "DFHashTable.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 
@@ -46,7 +47,7 @@ struct WordObjects {
 
 WordObjects *WordObjectsNew(WordPackage *package)
 {
-    WordObjects *objects = (WordObjects *)calloc(1,sizeof(WordObjects));
+    WordObjects *objects = (WordObjects *)xcalloc(1,sizeof(WordObjects));
     objects->package = WordPackageRetain(package);
     objects->drawingsById = DFHashTableNew((DFCopyFunction)WordDrawingRetain,(DFFreeFunction)WordDrawingRelease);
     objects->bookmarksById = DFHashTableNew((DFCopyFunction)WordBookmarkRetain,(DFFreeFunction)WordBookmarkRelease);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordPackage.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordPackage.c b/DocFormats/filters/ooxml/src/word/WordPackage.c
index 8e62243..7595de6 100644
--- a/DocFormats/filters/ooxml/src/word/WordPackage.c
+++ b/DocFormats/filters/ooxml/src/word/WordPackage.c
@@ -193,7 +193,7 @@ WordPackage *WordPackageOpenNew(DFStorage *storage, DFError **error)
         return NULL;
 
     int ok = 0;
-    WordPackage *package = (WordPackage *)calloc(1,sizeof(WordPackage));
+    WordPackage *package = (WordPackage *)xcalloc(1,sizeof(WordPackage));
     package->retainCount = 1;
     package->opc = opc;
     package->documentPart = OPCPackagePartWithURI(package->opc,"/word/document.xml");
@@ -230,7 +230,7 @@ WordPackage *WordPackageOpenFrom(DFStorage *storage, DFError **error)
         return NULL;
 
     int ok = 0;
-    WordPackage *package = (WordPackage *)calloc(1,sizeof(WordPackage));
+    WordPackage *package = (WordPackage *)xcalloc(1,sizeof(WordPackage));
     package->retainCount = 1;
     package->opc = opc;
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordSection.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordSection.c b/DocFormats/filters/ooxml/src/word/WordSection.c
index 8803370..97ca444 100644
--- a/DocFormats/filters/ooxml/src/word/WordSection.c
+++ b/DocFormats/filters/ooxml/src/word/WordSection.c
@@ -21,6 +21,7 @@
 #include "CSSLength.h"
 #include "DFString.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <math.h>
 #include <stdlib.h>
 
@@ -32,7 +33,7 @@
 
 WordSection *WordSectionNew(void)
 {
-    WordSection *section = (WordSection *)calloc(1,sizeof(WordSection));
+    WordSection *section = (WordSection *)xcalloc(1,sizeof(WordSection));
     section->pageWidth = A4_WIDTH_TWIPS;
     section->pageHeight = A4_HEIGHT_TWIPS;
     section->leftMargin = 0;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordSheet.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordSheet.c b/DocFormats/filters/ooxml/src/word/WordSheet.c
index f6ef195..178fde1 100644
--- a/DocFormats/filters/ooxml/src/word/WordSheet.c
+++ b/DocFormats/filters/ooxml/src/word/WordSheet.c
@@ -21,6 +21,7 @@
 #include "DFString.h"
 #include "Word.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -63,7 +64,7 @@ static WordStyle *WordStyleNew(DFNode *element, const char *type, const char *st
     assert(styleId != NULL);
     assert(element->tag == WORD_STYLE);
 
-    WordStyle *style = (WordStyle *)calloc(1,sizeof(WordStyle));
+    WordStyle *style = (WordStyle *)xcalloc(1,sizeof(WordStyle));
     style->retainCount = 1;
     style->element = element;
     style->type = (type != NULL) ? strdup(type) : NULL;
@@ -124,7 +125,7 @@ static void determineSelectors(WordSheet *sheet);
 
 WordSheet *WordSheetNew(DFDocument *doc)
 {
-    WordSheet *sheet = (WordSheet *)calloc(1,sizeof(WordSheet));
+    WordSheet *sheet = (WordSheet *)xcalloc(1,sizeof(WordSheet));
 
     sheet->stylesByIdent = DFHashTableNew((DFCopyFunction)WordStyleRetain,(DFFreeFunction)WordStyleRelease);
     sheet->stylesByName = DFHashTableNew((DFCopyFunction)WordStyleRetain,(DFFreeFunction)WordStyleRelease);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/WordTheme.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/WordTheme.c b/DocFormats/filters/ooxml/src/word/WordTheme.c
index e463360..1366b7a 100644
--- a/DocFormats/filters/ooxml/src/word/WordTheme.c
+++ b/DocFormats/filters/ooxml/src/word/WordTheme.c
@@ -32,7 +32,7 @@
 
 WordTheme *WordThemeNew(WordPackage *package)
 {
-    WordTheme *theme = (WordTheme *)calloc(1,sizeof(WordTheme));
+    WordTheme *theme = (WordTheme *)xcalloc(1,sizeof(WordTheme));
 
     DFDocument *doc = package->theme;
     if (doc == NULL)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c b/DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c
index ce96251..c9ff069 100644
--- a/DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c
+++ b/DocFormats/filters/ooxml/src/word/formatting/WordNumPr.c
@@ -137,7 +137,7 @@ struct WordNumInfo {
 
 static WordNumInfo *WordNumInfoNew(void)
 {
-    return (WordNumInfo *)calloc(1,sizeof(WordNumInfo));
+    return (WordNumInfo *)xcalloc(1,sizeof(WordNumInfo));
 }
 
 static void WordNumInfoFree(WordNumInfo *info)
@@ -278,7 +278,7 @@ void updateNumbering(WordConverter *converter, CSSSheet *cssSheet)
             CSSStyle *style = CSSSheetLookupSelector(cssSheet,allSelectors[i],0,0);
             if ((style->headingLevel >= 1) && (style->headingLevel <= 6)) {
                 int level = style->headingLevel - 1;
-                SelectorList *item = (SelectorList *)calloc(1,sizeof(SelectorList));
+                SelectorList *item = (SelectorList *)xcalloc(1,sizeof(SelectorList));
                 item->selector = strdup(style->selector);
                 item->next = DFHashTableLookupInt(selectorsByLevel,level);
                 DFHashTableAddInt(selectorsByLevel,level,item);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c b/DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c
index a82756e..5289a7c 100644
--- a/DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c
+++ b/DocFormats/filters/ooxml/src/word/lenses/WordBookmark.c
@@ -26,6 +26,7 @@
 #include "DFHTML.h"
 #include "DFString.h"
 #include "DFCommon.h"
+#include "DFPlatform.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -71,7 +72,7 @@ int WordBookmarkTypeHasLabel(WordBookmarkType type)
 
 WordBookmark *WordBookmarkNew(const char *bookmarkId1, const char *bookmarkName1)
 {
-    WordBookmark *bookmark = (WordBookmark *)calloc(1,sizeof(WordBookmark));
+    WordBookmark *bookmark = (WordBookmark *)xcalloc(1,sizeof(WordBookmark));
     bookmark->retainCount = 1;
     bookmark->bookmarkId = (bookmarkId1 != NULL) ? strdup(bookmarkId1) : NULL;
     bookmark->bookmarkName = (bookmarkName1 != NULL) ? strdup(bookmarkName1) : NULL;
@@ -441,7 +442,7 @@ struct WordRawBookmark {
 
 WordRawBookmark *WordRawBookmarkNew(void)
 {
-    WordRawBookmark *bookmark = (WordRawBookmark *)calloc(1,sizeof(WordRawBookmark));
+    WordRawBookmark *bookmark = (WordRawBookmark *)xcalloc(1,sizeof(WordRawBookmark));
     bookmark->startOffset = -1;
     bookmark->endOffset = -1;
     return bookmark;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c b/DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c
index f737868..2f60e54 100644
--- a/DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c
+++ b/DocFormats/filters/ooxml/src/word/lenses/WordDrawing.c
@@ -71,7 +71,7 @@ typedef struct {
 
 static ImageInfo *ImageInfoNew(const char *rId, double widthPts, double heightPts)
 {
-    ImageInfo *info = (ImageInfo *)calloc(1,sizeof(ImageInfo));
+    ImageInfo *info = (ImageInfo *)xcalloc(1,sizeof(ImageInfo));
     info->rId = DFStrDup(rId);
     info->widthPts = widthPts;
     info->heightPts = heightPts;
@@ -147,7 +147,7 @@ static const char *DrawingInfoDrawingId(DFNode *element)
 
 WordDrawing *WordDrawingNew(const char *drawingId)
 {
-    WordDrawing *drawing = (WordDrawing *)calloc(1,sizeof(WordDrawing));
+    WordDrawing *drawing = (WordDrawing *)xcalloc(1,sizeof(WordDrawing));
     drawing->retainCount = 1;
     drawing->drawingId = strdup(drawingId);
     return drawing;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/filters/ooxml/src/word/lenses/WordTable.c
----------------------------------------------------------------------
diff --git a/DocFormats/filters/ooxml/src/word/lenses/WordTable.c b/DocFormats/filters/ooxml/src/word/lenses/WordTable.c
index b84ce7e..6f69130 100644
--- a/DocFormats/filters/ooxml/src/word/lenses/WordTable.c
+++ b/DocFormats/filters/ooxml/src/word/lenses/WordTable.c
@@ -43,7 +43,7 @@ typedef struct {
 
 static ConcreteInfo *ConcreteInfoNew(void)
 {
-    ConcreteInfo *info = (ConcreteInfo *)calloc(1,sizeof(ConcreteInfo));
+    ConcreteInfo *info = (ConcreteInfo *)xcalloc(1,sizeof(ConcreteInfo));
     info->tableProperties = CSSPropertiesNew();
     info->cellProperties = CSSPropertiesNew();
     return info;

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/headers/DFPlatform.h
----------------------------------------------------------------------
diff --git a/DocFormats/headers/DFPlatform.h b/DocFormats/headers/DFPlatform.h
index faf5b6b..d3d2dba 100755
--- a/DocFormats/headers/DFPlatform.h
+++ b/DocFormats/headers/DFPlatform.h
@@ -101,8 +101,6 @@ int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle,
 
 void *xmalloc(size_t size);
 
-void xfree(void *ptr);
-
 void *xcalloc(size_t nmemb, size_t size);
 
 void *xrealloc(void *ptr, size_t size);

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/platform/src/Unix.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Unix.c b/DocFormats/platform/src/Unix.c
index 534c27b..5e78953 100644
--- a/DocFormats/platform/src/Unix.c
+++ b/DocFormats/platform/src/Unix.c
@@ -92,7 +92,7 @@ int DFAddDirContents(const char *absPath, const char *relPath, int recursive, DF
         else
             entryName = relSubPath;
 
-        *listptr = (DFDirEntryList *)calloc(1,sizeof(DFDirEntryList));
+        *listptr = (DFDirEntryList *)xcalloc(1,sizeof(DFDirEntryList));
         (*listptr)->name = strdup(entryName);
         listptr = &(*listptr)->next;
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/platform/src/Win32.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Win32.c b/DocFormats/platform/src/Win32.c
index ec865c5..0dd6533 100755
--- a/DocFormats/platform/src/Win32.c
+++ b/DocFormats/platform/src/Win32.c
@@ -121,7 +121,7 @@ int DFAddDirContents(const char *absPath, const char *relPath, int recursive, DF
         else
             entryName = relSubPath;
 
-        *listptr = (DFDirEntryList *)calloc(1,sizeof(DFDirEntryList));
+        *listptr = (DFDirEntryList *)xcalloc(1,sizeof(DFDirEntryList));
         (*listptr)->name = strdup(entryName);
         listptr = &(*listptr)->next;
 

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/f4162f65/DocFormats/platform/src/Wrapper.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper.c b/DocFormats/platform/src/Wrapper.c
index e788e96..500d85c 100644
--- a/DocFormats/platform/src/Wrapper.c
+++ b/DocFormats/platform/src/Wrapper.c
@@ -150,27 +150,22 @@ int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const i
     return (zipWriteInFileInZip(zipHandle->handle, buf, len) == ZIP_OK) ? 1 : -1;
 }
 
+
+
 void *xmalloc(size_t size)
 {
     void *ptr = malloc(size);
 
     if (ptr == NULL) {
         perror("xmalloc: out of memory.\n");
-        _exit(EXIT_FAILURE);
+        abort();
         return NULL;
     }
-    // uncomment to test this function
-    // else
-    //  printf("xmalloc: %zu\n", size);
 
     return ptr;
 }
 
-void xfree(void *ptr)
-{
-    free(ptr);
-    ptr = NULL;
-}
+
 
 void *xcalloc(size_t nmemb, size_t size)
 {
@@ -178,22 +173,24 @@ void *xcalloc(size_t nmemb, size_t size)
 
     if (ptr == NULL) {
         perror("xcalloc: out of memory.\n");
-        _exit(EXIT_FAILURE);
+        abort();
         return NULL;
     }
 
     return ptr;
 }
 
-void *xrealloc(void *ptr, size_t size)
+
+
+void *xrealloc(void *in_ptr, size_t size)
 {
-    void *ret_ptr = realloc(ptr, size);
+    void *ptr = realloc(in_ptr, size);
 
-    if (ret_ptr == NULL) {
+    if (ptr == NULL) {
         perror("xrealloc: out of memory.\n");
-        _exit(EXIT_FAILURE);
+        abort();
         return NULL;
     }
 
-    return ret_ptr;
+    return ptr;
 }