From 9b777deb00fb50dba37ccc1ee69767c6e04a3ee4 Mon Sep 17 00:00:00 2001 From: weili Date: Fri, 19 Aug 2016 16:19:46 -0700 Subject: Fix an embedder test with leaked page object The public API FPDFPage_New() incorrectly said to use FPDFPage_Delete() instead of FPDF_ClosePage() to free the new page. This led to a page object leak in an embedder test. Correct the public API description as well as its usage in the embedder test. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2260683003 --- fpdfsdk/fpdfedit_embeddertest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp index 720dcdec01..34b5993879 100644 --- a/fpdfsdk/fpdfedit_embeddertest.cpp +++ b/fpdfsdk/fpdfedit_embeddertest.cpp @@ -55,7 +55,7 @@ const char kExpectedPDF[] = TEST_F(FPDFEditEmbeddertest, EmptyCreation) { EXPECT_TRUE(CreateEmptyDocument()); - FPDF_PAGE page = FPDFPage_New(document(), 1, 640.0, 480.0); + FPDF_PAGE page = FPDFPage_New(document(), 0, 640.0, 480.0); EXPECT_NE(nullptr, page); EXPECT_TRUE(FPDFPage_GenerateContent(page)); EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); @@ -66,5 +66,5 @@ TEST_F(FPDFEditEmbeddertest, EmptyCreation) { std::replace(result.begin(), result.end(), '\0', '_'); EXPECT_THAT(result, testing::MatchesRegex( std::string(kExpectedPDF, sizeof(kExpectedPDF)))); - FPDFPage_Delete(document(), 1); + FPDF_ClosePage(page); } -- cgit v1.2.3