[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/tools/kfile-plugins/ooo
From:       Stephan Kulow <coolo () kde ! org>
Date:       2006-10-03 18:59:17
Message-ID: 1159901957.799658.4955.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 592068 by coolo:

fix memory leak (CID 2858)


 M  +8 -2      kfile_ooo.cpp  


--- trunk/koffice/tools/kfile-plugins/ooo/kfile_ooo.cpp #592067:592068
@@ -509,12 +509,18 @@
     KZip * m_zip = new KZip(tmp_file.name());
     KZip * current= new KZip(path);
     /* To correct problem with OOo 1.1, we have to recreate the file from scratch */
-    if (!m_zip->open(QIODevice::WriteOnly) || !current->open(QIODevice::ReadOnly) )
+    if (!m_zip->open(QIODevice::WriteOnly) || !current->open(QIODevice::ReadOnly) ) {
+            delete current;
+            delete m_zip;
 	    return false;
+    }
     QByteArray text = doc.toByteArray();
     m_zip->setCompression(KZip::DeflateCompression);
-    if (!copyZipToZip(current, m_zip))
+    if (!copyZipToZip(current, m_zip)) {
+            delete current;
+            delete m_zip;
 	    return false;
+    }
     m_zip->writeFile(QString(metafile), QString::null, QString::null,text,text.length());
     delete current;
     delete m_zip;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic