summaryrefslogtreecommitdiff
path: root/samples/pdfium_test.cc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-06 10:06:12 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-06 10:06:12 -0800
commitaa326bd6b169dc1b5b9b83048c71799799ab34c6 (patch)
tree5cdae330aa2fb40fecc701655b5c33ce85bf9ed3 /samples/pdfium_test.cc
parentd368261cc8d604286e29ca6358700e6bb051dcaa (diff)
downloadpdfium-aa326bd6b169dc1b5b9b83048c71799799ab34c6.tar.xz
Return unique_ptrs from test_support functions
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1563513002 .
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r--samples/pdfium_test.cc9
1 files changed, 4 insertions, 5 deletions
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<char, pdfium::FreeDeleter> file_contents =
+ GetFileContents(filename.c_str(), &file_length);
+ if (file_contents)
+ RenderPdf(filename, file_contents.get(), file_length, options);
}
FPDF_DestroyLibrary();