Uic: fix a leak

There are a couple of code paths in which we return from a function
without freeing the memory pointed by a local pointer.

For the sake of not over-modifying the code, I chose not to turn
"ui" into a scoped pointer.

Change-Id: I0b23944f7526d250c1ebeca0bae9bdc36dceceed
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
bb10
Giuseppe D'Angelo 2014-09-20 17:57:30 +02:00 committed by hjk
parent 097b641c3e
commit 5222abfdf5
1 changed files with 2 additions and 0 deletions

View File

@ -219,6 +219,7 @@ bool Uic::write(QIODevice *in)
#ifdef QT_UIC_JAVA_GENERATOR
if (language.toLower() != QLatin1String("jambi")) {
fprintf(stderr, "uic: File is not a 'jambi' form\n");
delete ui;
return false;
}
rtn = jwrite (ui);
@ -229,6 +230,7 @@ bool Uic::write(QIODevice *in)
#ifdef QT_UIC_CPP_GENERATOR
if (!language.isEmpty() && language.toLower() != QLatin1String("c++")) {
fprintf(stderr, "uic: File is not a 'c++' ui file, language=%s\n", qPrintable(language));
delete ui;
return false;
}