r20735 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Wed Jan 27 22:45:22 UTC 2016


Author: jghali
Date: Wed Jan 27 22:45:21 2016
New Revision: 20735

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20735
Log:
fix resource leaks <coverity>

Modified:
    trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp

Modified: trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20735&path=/trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/sxwim/stylereader.cpp	Wed Jan 27 22:45:21 2016
@@ -810,21 +810,16 @@
  
  void StyleReader::startElement(void*, const xmlChar * fullname, const xmlChar ** atts)
  {
- 	QString* name = new QString((const char*) fullname);
- 	name = new QString(name->toLower());
- 	QXmlAttributes* attrs = new QXmlAttributes();
- 	if (atts)
- 	{
- 		for(const xmlChar** cur = atts; cur && *cur; cur += 2)
- 			attrs->append(QString((char*)*cur), NULL, QString((char*)*cur), QString((char*)*(cur + 1)));
- 	}
- 	sreader->startElement(NULL, NULL, *name, *attrs);
+ 	QString name = QString((const char*) fullname).toLower();
+ 	QXmlAttributes attrs;
+ 	for(const xmlChar** cur = atts; cur && *cur; cur += 2)
+ 		attrs.append(QString((char*)*cur), NULL, QString((char*)*cur), QString((char*)*(cur + 1)));
+ 	sreader->startElement(NULL, NULL, name, attrs);
  }
  
  void StyleReader::endElement(void*, const xmlChar * name)
  {
- 	QString *nname = new QString((const char*) name);
- 	nname = new QString(nname->toLower());
- 	sreader->endElement(NULL, NULL, *nname);
- }
- 
+ 	QString nname = QString((const char*) name).toLower();
+ 	sreader->endElement(NULL, NULL, nname);
+ }
+ 




More information about the scribus-commit mailing list