diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
index 69dc6fcb8cb..0875430ef6e 100644
--- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
@@ -1914,6 +1914,7 @@ PRBool BasicTableLayoutStrategy::ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex)
void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
{
char* indent = new char[aIndent + 1];
+ if (!indent) return;
for (PRInt32 i = 0; i < aIndent + 1; i++) {
indent[i] = ' ';
}
diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
index d438c08b7a6..e4713ba195b 100644
--- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
@@ -79,9 +79,14 @@ FixedTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre
nscoord totalColWidth = 0; // the sum of the widths of the columns
nscoord* colWidths = new PRBool[numCols];
+ if (!colWidths) return PR_FALSE;
nsCRT::memset(colWidths, WIDTH_NOT_SET, numCols*sizeof(nscoord));
nscoord* propInfo = new PRBool[numCols];
+ if (!propInfo) {
+ delete [] colWidths;
+ return PR_FALSE;
+ }
nsCRT::memset(propInfo, 0, numCols*sizeof(nscoord));
nscoord propTotal = 0;
diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp
index 744e10d29ca..c1168a27cf1 100644
--- a/mozilla/layout/html/table/src/nsCellMap.cpp
+++ b/mozilla/layout/html/table/src/nsCellMap.cpp
@@ -711,6 +711,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
// Setup CellData for this cell
CellData* origData = new CellData(&aCellFrame);
+ if (!origData) return startColIndex;
SetMapCellAt(aMap, *origData, aRowIndex, startColIndex, PR_TRUE);
// initialize the cell frame
@@ -757,6 +758,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
}
else {
cellData = new CellData(nsnull);
+ if (!cellData) return startColIndex;
if (rowX > aRowIndex) {
cellData->SetRowSpanOffset(rowX - aRowIndex);
}
diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
index d37cb8db708..e4796ec43d4 100644
--- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
@@ -1333,6 +1333,7 @@ GetCollapseOffsetProperty(nsIPresContext* aPresContext,
// The property isn't set yet, so allocate a new point, set the property,
// and return the newly allocated point
nsPoint* offset = new nsPoint(0, 0);
+ if (!offset) return nsnull;
frameManager->SetFrameProperty(aFrame, nsLayoutAtoms::collapseOffsetProperty,
offset, DestroyPointFunc);
diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp
index 8b2b9e061a5..a724a4d49c0 100644
--- a/mozilla/layout/html/table/src/nsTableColFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp
@@ -216,6 +216,7 @@ nscoord nsTableColFrame::GetPctWidth()
void nsTableColFrame::Dump(PRInt32 aIndent)
{
char* indent = new char[aIndent + 1];
+ if (!indent) return;
for (PRInt32 i = 0; i < aIndent + 1; i++) {
indent[i] = ' ';
}
diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index 275b1ad9e9c..6b78c7325a9 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -183,7 +183,9 @@ nsTableFrame::nsTableFrame()
#else
mColumnWidthsLength = 5;
mColumnWidths = new PRInt32[mColumnWidthsLength];
- nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
+ if (mColumnWidths) {
+ nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
+ }
#endif
}
@@ -217,6 +219,7 @@ nsTableFrame::Init(nsIPresContext* aPresContext,
// Create the cell map
// XXX Why do we do this for continuing frames?
mCellMap = new nsTableCellMap(aPresContext, *this);
+ if (!mCellMap) return NS_ERROR_OUT_OF_MEMORY;
// Let the base class do its processing
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
@@ -3371,6 +3374,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mColumnWidthsLength += kColumnWidthIncrement;
}
PRInt32 * newColumnWidthsArray = new PRInt32[mColumnWidthsLength];
+ if (!newColumnWidthsArray) return;
nsCRT::memset (newColumnWidthsArray, 0, mColumnWidthsLength*sizeof(PRInt32));
if (mColumnWidths) {
nsCRT::memcpy (newColumnWidthsArray, mColumnWidths, priorColumnWidthsLength*sizeof(PRInt32));
@@ -3393,6 +3397,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
else
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
+ if (!mTableLayoutStrategy) return;
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
mBits.mColumnWidthsValid=PR_TRUE;
}
@@ -3761,6 +3766,7 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, nscoord aWidth)
if (!mColumnWidths) {
mColumnWidthsLength = mCellMap->GetColCount(); // mCellMap is valid since first inflow
mColumnWidths = new PRInt32[mColumnWidthsLength];
+ if (!mColumnWidths) return;
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
}
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index 69dc6fcb8cb..0875430ef6e 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -1914,6 +1914,7 @@ PRBool BasicTableLayoutStrategy::ColIsSpecifiedAsMinimumWidth(PRInt32 aColIndex)
void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
{
char* indent = new char[aIndent + 1];
+ if (!indent) return;
for (PRInt32 i = 0; i < aIndent + 1; i++) {
indent[i] = ' ';
}
diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
index d438c08b7a6..e4713ba195b 100644
--- a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
@@ -79,9 +79,14 @@ FixedTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre
nscoord totalColWidth = 0; // the sum of the widths of the columns
nscoord* colWidths = new PRBool[numCols];
+ if (!colWidths) return PR_FALSE;
nsCRT::memset(colWidths, WIDTH_NOT_SET, numCols*sizeof(nscoord));
nscoord* propInfo = new PRBool[numCols];
+ if (!propInfo) {
+ delete [] colWidths;
+ return PR_FALSE;
+ }
nsCRT::memset(propInfo, 0, numCols*sizeof(nscoord));
nscoord propTotal = 0;
diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp
index 744e10d29ca..c1168a27cf1 100644
--- a/mozilla/layout/tables/nsCellMap.cpp
+++ b/mozilla/layout/tables/nsCellMap.cpp
@@ -711,6 +711,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
// Setup CellData for this cell
CellData* origData = new CellData(&aCellFrame);
+ if (!origData) return startColIndex;
SetMapCellAt(aMap, *origData, aRowIndex, startColIndex, PR_TRUE);
// initialize the cell frame
@@ -757,6 +758,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
}
else {
cellData = new CellData(nsnull);
+ if (!cellData) return startColIndex;
if (rowX > aRowIndex) {
cellData->SetRowSpanOffset(rowX - aRowIndex);
}
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index d37cb8db708..e4796ec43d4 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -1333,6 +1333,7 @@ GetCollapseOffsetProperty(nsIPresContext* aPresContext,
// The property isn't set yet, so allocate a new point, set the property,
// and return the newly allocated point
nsPoint* offset = new nsPoint(0, 0);
+ if (!offset) return nsnull;
frameManager->SetFrameProperty(aFrame, nsLayoutAtoms::collapseOffsetProperty,
offset, DestroyPointFunc);
diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp
index 8b2b9e061a5..a724a4d49c0 100644
--- a/mozilla/layout/tables/nsTableColFrame.cpp
+++ b/mozilla/layout/tables/nsTableColFrame.cpp
@@ -216,6 +216,7 @@ nscoord nsTableColFrame::GetPctWidth()
void nsTableColFrame::Dump(PRInt32 aIndent)
{
char* indent = new char[aIndent + 1];
+ if (!indent) return;
for (PRInt32 i = 0; i < aIndent + 1; i++) {
indent[i] = ' ';
}
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index 275b1ad9e9c..6b78c7325a9 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -183,7 +183,9 @@ nsTableFrame::nsTableFrame()
#else
mColumnWidthsLength = 5;
mColumnWidths = new PRInt32[mColumnWidthsLength];
- nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
+ if (mColumnWidths) {
+ nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
+ }
#endif
}
@@ -217,6 +219,7 @@ nsTableFrame::Init(nsIPresContext* aPresContext,
// Create the cell map
// XXX Why do we do this for continuing frames?
mCellMap = new nsTableCellMap(aPresContext, *this);
+ if (!mCellMap) return NS_ERROR_OUT_OF_MEMORY;
// Let the base class do its processing
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
@@ -3371,6 +3374,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mColumnWidthsLength += kColumnWidthIncrement;
}
PRInt32 * newColumnWidthsArray = new PRInt32[mColumnWidthsLength];
+ if (!newColumnWidthsArray) return;
nsCRT::memset (newColumnWidthsArray, 0, mColumnWidthsLength*sizeof(PRInt32));
if (mColumnWidths) {
nsCRT::memcpy (newColumnWidthsArray, mColumnWidths, priorColumnWidthsLength*sizeof(PRInt32));
@@ -3393,6 +3397,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
else
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
+ if (!mTableLayoutStrategy) return;
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth, aReflowState);
mBits.mColumnWidthsValid=PR_TRUE;
}
@@ -3761,6 +3766,7 @@ void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, nscoord aWidth)
if (!mColumnWidths) {
mColumnWidthsLength = mCellMap->GetColCount(); // mCellMap is valid since first inflow
mColumnWidths = new PRInt32[mColumnWidthsLength];
+ if (!mColumnWidths) return;
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
}