Bug 14012

Summary: Two "use after free" bugs in HtmlOutputDev.cc
Product: poppler Reporter: Kjartan Maraas <kmaraas>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: jwhite
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Kjartan Maraas 2008-01-10 14:02:57 UTC
The coverity checker found these two:

--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -820,8 +820,8 @@ void HtmlOutputDev::doFrame(int firstPage){
   fName->append(".html");
 
   if (!(fContentsFrame = fopen(fName->getCString(), "w"))){
-    delete fName;
     error(-1, "Couldn't open html file '%s'", fName->getCString());
+    delete fName;
     return;
   }
   
@@ -934,8 +934,8 @@ HtmlOutputDev::HtmlOutputDev(char *fileName, char *title,
       if (!xml) right->append(".html");
       if (xml) right->append(".xml");
       if (!(page=fopen(right->getCString(),"w"))){
-       delete right;
        error(-1, "Couldn't open html file '%s'", right->getCString());
+       delete right;
        return;
       }  
       delete right;
Comment 1 Albert Astals Cid 2008-01-10 14:52:09 UTC
Fixed, thanks.
Comment 2 Daniel Stone 2008-08-26 10:00:02 UTC
*** Bug 17032 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.