Commit 6fedd991 authored by Albert Astals Cid's avatar Albert Astals Cid

* qt4/src/poppler-embeddedfile.cc:

* qt4/src/poppler-document.cc:
* qt/poppler-document.cc: Fix memory leaks
parent 7da5885e
2006-12-28 Albert Astals Cid <aacid@kde.org>
* qt4/src/poppler-embeddedfile.cc:
* qt4/src/poppler-document.cc:
* qt/poppler-document.cc: Fix memory leaks.
2006-12-28 Albert Astals Cid <aacid@kde.org> 2006-12-28 Albert Astals Cid <aacid@kde.org>
* goo/GooString.cc * goo/GooString.cc
......
...@@ -216,6 +216,7 @@ QDateTime Document::getDate( const QString & type ) const ...@@ -216,6 +216,7 @@ QDateTime Document::getDate( const QString & type ) const
if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() )
{ {
s = UGooString(*obj.getString()).getCString(); s = UGooString(*obj.getString()).getCString();
const char *aux = s;
if ( s[0] == 'D' && s[1] == ':' ) if ( s[0] == 'D' && s[1] == ':' )
s += 2; s += 2;
/* FIXME process time zone on systems that support it */ /* FIXME process time zone on systems that support it */
...@@ -232,6 +233,7 @@ QDateTime Document::getDate( const QString & type ) const ...@@ -232,6 +233,7 @@ QDateTime Document::getDate( const QString & type ) const
else { else {
obj.free(); obj.free();
info.free(); info.free();
delete[] aux;
return QDateTime(); return QDateTime();
} }
} }
...@@ -241,9 +243,11 @@ QDateTime Document::getDate( const QString & type ) const ...@@ -241,9 +243,11 @@ QDateTime Document::getDate( const QString & type ) const
if ( d.isValid() && t.isValid() ) { if ( d.isValid() && t.isValid() ) {
obj.free(); obj.free();
info.free(); info.free();
delete[] aux;
return QDateTime( d, t ); return QDateTime( d, t );
} }
} }
delete[] aux;
} }
obj.free(); obj.free();
info.free(); info.free();
......
...@@ -248,7 +248,9 @@ namespace Poppler { ...@@ -248,7 +248,9 @@ namespace Poppler {
Dict *infoDict = info.getDict(); Dict *infoDict = info.getDict();
// somehow iterate over keys in infoDict // somehow iterate over keys in infoDict
for( int i=0; i < infoDict->getLength(); ++i ) { for( int i=0; i < infoDict->getLength(); ++i ) {
keys.append( QString::fromAscii(infoDict->getKey(i)->getCString()) ); const char *aux = infoDict->getKey(i)->getCString();
keys.append( QString::fromAscii(aux) );
delete[] aux;
} }
info.free(); info.free();
......
...@@ -46,7 +46,9 @@ EmbeddedFile::EmbeddedFile(EmbFile *embfile) ...@@ -46,7 +46,9 @@ EmbeddedFile::EmbeddedFile(EmbFile *embfile)
{ {
m_embeddedFile = new EmbeddedFileData(); m_embeddedFile = new EmbeddedFileData();
m_embeddedFile->m_label = QString(embfile->name()->getCString()); m_embeddedFile->m_label = QString(embfile->name()->getCString());
m_embeddedFile->m_description = QString(UGooString(*embfile->description()).getCString()); const char *aux = UGooString(*embfile->description()).getCString();
m_embeddedFile->m_description = QString(aux);
delete[] aux;
m_embeddedFile->m_modDate = convertDate(embfile->modDate()->getCString()); m_embeddedFile->m_modDate = convertDate(embfile->modDate()->getCString());
m_embeddedFile->m_createDate = convertDate(embfile->createDate()->getCString()); m_embeddedFile->m_createDate = convertDate(embfile->createDate()->getCString());
embfile->streamObject().copy(&m_embeddedFile->m_streamObject); embfile->streamObject().copy(&m_embeddedFile->m_streamObject);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment