diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java index d4c220459..3d1ee2a58 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java @@ -155,6 +155,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { tables.add(t); } } + cursor.dispose(); // Sort out headers and footers if (doc.getDocument().getBody().getSectPr() != null) diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java index 7b33d48c0..2e7e16f3e 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java @@ -140,6 +140,7 @@ public class XWPFParagraph implements IBodyElement{ footnoteText.append("]"); } } + c.dispose(); } } }