[Libreoffice-commits] libcdr.git: configure.ac src/lib

David Tardon dtardon at redhat.com
Sat Jul 6 03:28:37 PDT 2013


 configure.ac            |    1 +
 src/lib/CDRDocument.cpp |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit df155ad555c5e4eb9c991d7e08b5a7816e399257
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Jul 6 12:25:08 2013 +0200

    coverity: avoid memory leak on exception

diff --git a/configure.ac b/configure.ac
index 84f2db1..c963784 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,7 @@ AC_SUBST(ICU_LIBS)
 AC_CHECK_HEADERS(
 	boost/optional.hpp \
 	boost/property_tree/ptree.hpp \
+	boost/scoped_ptr.hpp \
 	boost/spirit/include/classic.hpp \
 	boost/property_tree/json_parser.hpp,
 	[],
diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index eeadfaf..6ab7d4d 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -29,6 +29,7 @@
 
 #include <string>
 #include <string.h>
+#include <boost/scoped_ptr.hpp>
 #include <libcdr/libcdr.h>
 #include "CDRParser.h"
 #include "CDRSVGGenerator.h"
@@ -179,13 +180,13 @@ bool libcdr::CDRDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInterfa
         input = zinput.getDocumentOLEStream("content/root.dat");
         if (input)
         {
-          WPXInputStream *tmpStream = zinput.getDocumentOLEStream("content/dataFileList.dat");
-          if (tmpStream)
+          boost::scoped_ptr<WPXInputStream> tmpStream(zinput.getDocumentOLEStream("content/dataFileList.dat"));
+          if (bool(tmpStream))
           {
             std::string dataFileName;
             while (!tmpStream->atEOS())
             {
-              unsigned char character = readU8(tmpStream);
+              unsigned char character = readU8(tmpStream.get());
               if (character == 0x0a)
               {
                 dataFiles.push_back(dataFileName);


More information about the Libreoffice-commits mailing list