From 9acf20771b624132833b2ca1e8bc421f69774f1e Mon Sep 17 00:00:00 2001 From: Zachary Blair Date: Sun, 27 Jun 2010 22:38:16 +0200 Subject: Fix suspicious code found by static code analysis: * Missing break in switch * delete instead of delete[] * Null-pointer check after dereference Merge-request: 716 Reviewed-by: Andreas Kling --- src/gui/styles/qcleanlooksstyle.cpp | 1 + src/gui/styles/qwindowscestyle.cpp | 1 + src/gui/styles/qwindowsxpstyle.cpp | 2 +- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 6 +++--- src/qt3support/text/q3richtext.cpp | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 883f511..cb48def 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -3763,6 +3763,7 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option break; case PM_MenuBarItemSpacing: ret = 6; + break; case PM_MenuBarHMargin: ret = 0; break; diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp index b027005..bd7246a 100644 --- a/src/gui/styles/qwindowscestyle.cpp +++ b/src/gui/styles/qwindowscestyle.cpp @@ -2294,6 +2294,7 @@ int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QW break; case SH_EtchDisabledText: ret = false; + break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClick; break; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index efb1224..8858475 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -4052,7 +4052,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h) bufferPos += sprintf(bufferPos, "\n};\n\n"); printf(bufferDump); - delete bufferDump; + delete[] bufferDump; ++pCount; } } diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index ecd03e5..19f3b3c 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -127,7 +127,7 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const } } - delete streams; + delete[] streams; } } @@ -201,7 +201,7 @@ QList QAudioDeviceInfoInternal::frequencyList() rc << vr[i].mMaximum; } - delete vr; + delete[] vr; } } @@ -345,7 +345,7 @@ QList QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) } } - delete audioDevices; + delete[] audioDevices; } } diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index 8614076..625dd95 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -8079,9 +8079,9 @@ bool Q3TextTable::down(Q3TextCursor *c, Q3TextDocument *&doc, Q3TextParagraph *& break; } } - doc = cell->richText(); if (!cell) return false; + doc = cell->richText(); parag = doc->firstParagraph(); idx = 0; ox += cell->geometry().x() + cell->horizontalAlignmentOffset() + outerborder + parent->x(); @@ -8117,9 +8117,9 @@ bool Q3TextTable::up(Q3TextCursor *c, Q3TextDocument *&doc, Q3TextParagraph *&pa break; } } - doc = cell->richText(); if (!cell) return false; + doc = cell->richText(); parag = doc->lastParagraph(); idx = parag->length() - 1; ox += cell->geometry().x() + cell->horizontalAlignmentOffset() + outerborder + parent->x(); -- cgit v0.12