r20750 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Fri Jan 29 21:47:49 UTC 2016
Author: jghali
Date: Fri Jan 29 21:47:49 2016
New Revision: 20750
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20750
Log:
fix resource leak in object <coverity> + bug introduced by r20717
Modified:
trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.h
Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20750&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.cpp Fri Jan 29 21:47:49 2016
@@ -67,6 +67,12 @@
loadFile(fname);
}
+PdbIm::~PdbIm()
+{
+ if (m_buf)
+ delete m_buf;
+}
+
void PdbIm::write()
{
QTextCodec *codec;
@@ -98,7 +104,7 @@
return;
}
size_t result = fread( &m_header, PDB_HEADER_SIZE, 1, m_pdfp );
- if (result != PDB_HEADER_SIZE)
+ if (result != 1)
{
fclose(m_pdfp);
return;
@@ -120,7 +126,7 @@
GET_DWord(m_pdfp, offset);
fseek(m_pdfp, offset, SEEK_SET);
result = fread(&m_rec0, sizeof(m_rec0), 1, m_pdfp);
- if (result != sizeof(m_rec0))
+ if (result != 1)
{
fclose(m_pdfp);
return;
Modified: trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20750&path=/trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/pdbim/pdbim.h Fri Jan 29 21:47:49 2016
@@ -96,8 +96,8 @@
UT_uint32 position;
} buffer;
-#define GET_Word(f,n) { size_t result = fread( &n, 2, 1, f ); if (result == 2) n = swap_Word ( n ); }
-#define GET_DWord(f,n) { size_t result = fread( &n, 4, 1, f ); if (result == 4) n = swap_DWord( n ); }
+#define GET_Word(f,n) { size_t result = fread( &n, 2, 1, f ); if (result == 1) n = swap_Word ( n ); }
+#define GET_DWord(f,n) { size_t result = fread( &n, 4, 1, f ); if (result == 1) n = swap_DWord( n ); }
/*! \brief An import filter for Palm Documents (PDB files).
PDB documents are simple non-formatted texts in binary forms used
@@ -119,7 +119,7 @@
\param enc user selected text encoding. See encoding attr.
\param w a reference to the gtWriter instance */
PdbIm(const QString& fname, const QString& enc, gtWriter *w);
- ~PdbIm(){};
+ ~PdbIm();
/*! \brief Write data into Scribus text frame.
User should specify encoding of the imported text - it's recoded here. */
void write();
More information about the scribus-commit
mailing list