From e8d867ca8a2e52e8521779aecf1b9144b1d54a3f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 19 Mar 2023 22:20:24 +0100 Subject: [PATCH] update: remove unnecessary initialization on the heap Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/81bfacf9926fb8c254b20694f4371bb88408697c Author: Thilo Graf Date: 2023-03-19 (Sun, 19 Mar 2023) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/update.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index bfeb9ce79..b6d66229f 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -420,8 +420,8 @@ bool CFlashUpdate::checkVersion4Update() hide(); - versionInfo = new CFlashVersionInfo(newVersion); // Memory leak: versionInfo - sprintf(msg, g_Locale->getText(LOCALE_FLASHUPDATE_MSGBOX), versionInfo->getType(true), versionInfo->getVersionString(), versionInfo->getDate(), versionInfo->getTime()); + CFlashVersionInfo versionInfo(newVersion); + sprintf(msg, g_Locale->getText(LOCALE_FLASHUPDATE_MSGBOX), versionInfo.getType(true), versionInfo.getVersionString(), versionInfo.getDate(), versionInfo.getTime()); if (gotImage) { @@ -429,7 +429,6 @@ bool CFlashUpdate::checkVersion4Update() if ((strncmp(PACKAGE_RELEASE_CYCLE, versionInfo->getReleaseCycle(), 2) != 0) && (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_WRONGBASE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) { - delete versionInfo; return false; } #endif @@ -437,12 +436,9 @@ bool CFlashUpdate::checkVersion4Update() if ((fileType != '0' /*Release*/) && (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_FLASHUPDATE_EXPERIMENTALIMAGE, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_UPDATE) != CMsgBox::mbrYes)) { - delete versionInfo; return false; } } - - delete versionInfo; } else {