Fix pdfium-i#236: memory leaks from RenderPdf
authorQin Zhao <zhaoqin@google.com>
Tue, 20 Oct 2015 22:20:11 +0000 (18:20 -0400)
committerQin Zhao <zhaoqin@google.com>
Tue, 20 Oct 2015 22:20:11 +0000 (18:20 -0400)
- add FPDFAvail_Destroy(pdf_avail) on the early return path in RenderPdf

R=thestig@chromium.org
BUG=pdfium:236

Review URL: https://codereview.chromium.org/1410333007 .

samples/pdfium_test.cc

index 1050425..66dd3f2 100644 (file)
@@ -391,6 +391,7 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
 
   if (!doc) {
     fprintf(stderr, "Load pdf docs unsuccessful.\n");
+    FPDFAvail_Destroy(pdf_avail);
     return;
   }