Index: source/samples/layout/paragraph.cpp |
diff --git a/source/samples/layout/paragraph.cpp b/source/samples/layout/paragraph.cpp |
index 65d3e3684239eb5932475c0b1878778897cf4de6..9a92b5876d46b8678f6952fc8841b39bbb2cced1 100644 |
--- a/source/samples/layout/paragraph.cpp |
+++ b/source/samples/layout/paragraph.cpp |
@@ -1,7 +1,7 @@ |
/* |
******************************************************************************* |
* |
- * Copyright (C) 1999-2007, International Business Machines |
+ * Copyright (C) 1999-2015, International Business Machines |
* Corporation and others. All Rights Reserved. |
* |
******************************************************************************* |
@@ -115,6 +115,7 @@ Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns |
paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, NULL, NULL, locales, fParagraphLevel, FALSE, status); |
if (LE_FAILURE(status)) { |
+ delete paragraphLayout; |
break; // return? something else? |
} |
@@ -163,8 +164,12 @@ Paragraph::~Paragraph() |
delete /*(LineInfo *)*/ fLines[line]; |
} |
+ for (le_int32 paragraph = 0; paragraph < fParagraphCount; paragraph += 1) { |
+ delete fParagraphLayout[paragraph]; |
+ } |
+ |
LE_DELETE_ARRAY(fLines); |
- delete fParagraphLayout; |
+ LE_DELETE_ARRAY(fParagraphLayout); |
LE_DELETE_ARRAY(fChars); |
} |