Index: samples/pdfium_test.cc |
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc |
index 9816bb8a31e9069ab64959b853b75ea8b3462bc8..c522a318e60ad5ac82007bdf12a604092694c94d 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(); |