From aa326bd6b169dc1b5b9b83048c71799799ab34c6 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 6 Jan 2016 10:06:12 -0800 Subject: Return unique_ptrs from test_support functions R=thestig@chromium.org Review URL: https://codereview.chromium.org/1563513002 . --- samples/pdfium_test.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'samples/pdfium_test.cc') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 9816bb8a31..c522a318e6 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -590,11 +590,10 @@ int main(int argc, const char* argv[]) { std::string filename = files.front(); files.pop_front(); size_t file_length = 0; - char* file_contents = GetFileContents(filename.c_str(), &file_length); - if (!file_contents) - continue; - RenderPdf(filename, file_contents, file_length, options); - free(file_contents); + std::unique_ptr file_contents = + GetFileContents(filename.c_str(), &file_length); + if (file_contents) + RenderPdf(filename, file_contents.get(), file_length, options); } FPDF_DestroyLibrary(); -- cgit v1.2.3