From 2f63e99a0cc0f736f7e45425d4f47b82dfa37ec1 Mon Sep 17 00:00:00 2001 From: "reed%reedloden.com" Date: Wed, 5 Mar 2008 10:31:55 +0000 Subject: [PATCH] Bug 419654 - "Importing bookmark file corrupts heap (reproducible)" (Fix heap corruption and increase initial capacity) [p=ondrej@allpeers.com (Ondrej Brablc) r=dietrich a=blocking-firefox3+] git-svn-id: svn://10.0.0.236/trunk@247087 18797224-902f-48f8-a5cc-f745e15eee43 --- .../places/src/nsPlacesImportExportService.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mozilla/browser/components/places/src/nsPlacesImportExportService.cpp b/mozilla/browser/components/places/src/nsPlacesImportExportService.cpp index 9025bf5d9db..2649b74d011 100644 --- a/mozilla/browser/components/places/src/nsPlacesImportExportService.cpp +++ b/mozilla/browser/components/places/src/nsPlacesImportExportService.cpp @@ -329,6 +329,8 @@ nsPlacesImportExportService::~nsPlacesImportExportService() class BookmarkContentSink : public nsIHTMLContentSink { public: + BookmarkContentSink(); + nsresult Init(PRBool aAllowRootChanges, nsINavBookmarksService* bookmarkService, PRInt64 aFolder, @@ -436,6 +438,10 @@ protected: #endif }; +BookmarkContentSink::BookmarkContentSink() : mFrames(16) +{ +} + // BookmarkContentSink::Init // // Note that the bookmark service pointer is passed in. We can not create @@ -1222,9 +1228,11 @@ BookmarkContentSink::NewFrame() // don't clear last-modified, in case there's a description } + frame.mPreviousId = ourID; + if (!mFrames.AppendElement(BookmarkImportFrame(ourID))) return NS_ERROR_OUT_OF_MEMORY; - frame.mPreviousId = ourID; + return NS_OK; }