Avoid potential leak of memory pointed to by QTreeWidgetItem catItem

This commit is contained in:
Stephan Witt 2020-02-20 08:12:08 +01:00
parent aa18a079cf
commit 2bf7756196

View File

@ -418,8 +418,9 @@ void GuiLyXFiles::updateContents()
qstring_to_ucs4(guiString(catsave.mid(catsave.indexOf('/') + 1))))); qstring_to_ucs4(guiString(catsave.mid(catsave.indexOf('/') + 1)))));
} }
cat = toqstr(translateIfPossible(qstring_to_ucs4(guiString(cat)))); cat = toqstr(translateIfPossible(qstring_to_ucs4(guiString(cat))));
QTreeWidgetItem * catItem = new QTreeWidgetItem(); QTreeWidgetItem * catItem;
if (!cats.contains(cat)) { if (!cats.contains(cat)) {
catItem = new QTreeWidgetItem();
catItem->setText(0, cat); catItem->setText(0, cat);
catItem->setFont(0, capfont); catItem->setFont(0, capfont);
filesLW->insertTopLevelItem(0, catItem); filesLW->insertTopLevelItem(0, catItem);