summaryrefslogtreecommitdiff
authorerik <erik>2007-02-08 01:45:16 (UTC)
committer erik <erik>2007-02-08 01:45:16 (UTC)
commit2e497f7cae45184184e2416114887095735958f5 (patch) (unidiff)
treea6b399d9bce5854dc7ad6c985b48965cf20680b0
parent853b61f97e718359bef95147ab3c7beb0705acda (diff)
downloadopie-2e497f7cae45184184e2416114887095735958f5.zip
opie-2e497f7cae45184184e2416114887095735958f5.tar.gz
opie-2e497f7cae45184184e2416114887095735958f5.tar.bz2
Each file in this commit has a problem where it is possible to dereference
a pointer without that pointer being valid. This commit fixes each instance of that.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/modplug/sndfile.cpp5
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/block.c2
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/info.c2
-rw-r--r--noncore/apps/opie-write/qrichtext.cpp41
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp3
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp6
6 files changed, 46 insertions, 13 deletions
diff --git a/core/multimedia/opieplayer/modplug/sndfile.cpp b/core/multimedia/opieplayer/modplug/sndfile.cpp
index 1d0d610..799555c 100644
--- a/core/multimedia/opieplayer/modplug/sndfile.cpp
+++ b/core/multimedia/opieplayer/modplug/sndfile.cpp
@@ -1741,3 +1741,6 @@ BOOL CSoundFile::SetPatternName(UINT nPat, LPCSTR lpszName)
1741 if (nPat >= MAX_PATTERNS) return FALSE; 1741 if (nPat >= MAX_PATTERNS) return FALSE;
1742 if (lpszName) lstrcpyn(szName, lpszName, MAX_PATTERNNAME); 1742 if (lpszName)
1743 lstrcpyn(szName, lpszName, MAX_PATTERNNAME);
1744 else
1745 return FALSE;
1743 szName[MAX_PATTERNNAME-1] = 0; 1746 szName[MAX_PATTERNNAME-1] = 0;
diff --git a/core/multimedia/opieplayer/vorbis/tremor/block.c b/core/multimedia/opieplayer/vorbis/tremor/block.c
index 8949253..7b5531b 100644
--- a/core/multimedia/opieplayer/vorbis/tremor/block.c
+++ b/core/multimedia/opieplayer/vorbis/tremor/block.c
@@ -228,4 +228,6 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
228 if(v->pcm){ 228 if(v->pcm){
229 if (vi) {
229 for(i=0;i<vi->channels;i++) 230 for(i=0;i<vi->channels;i++)
230 if(v->pcm[i])_ogg_free(v->pcm[i]); 231 if(v->pcm[i])_ogg_free(v->pcm[i]);
232 }
231 _ogg_free(v->pcm); 233 _ogg_free(v->pcm);
diff --git a/core/multimedia/opieplayer/vorbis/tremor/info.c b/core/multimedia/opieplayer/vorbis/tremor/info.c
index 941695e..3499ae4 100644
--- a/core/multimedia/opieplayer/vorbis/tremor/info.c
+++ b/core/multimedia/opieplayer/vorbis/tremor/info.c
@@ -99,5 +99,5 @@ void vorbis_comment_clear(vorbis_comment *vc){
99 if(vc->vendor)_ogg_free(vc->vendor); 99 if(vc->vendor)_ogg_free(vc->vendor);
100 }
101 memset(vc,0,sizeof(*vc)); 100 memset(vc,0,sizeof(*vc));
102} 101}
102}
103 103
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp
index f040f1e..768da44 100644
--- a/noncore/apps/opie-write/qrichtext.cpp
+++ b/noncore/apps/opie-write/qrichtext.cpp
@@ -191,5 +191,8 @@ QTextCursor *QTextDeleteCommand::execute( QTextCursor *c )
191 QTextParagraph *s = doc ? doc->paragAt( id ) : parag; 191 QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
192 if ( !s ) { 192 if ( !s && doc ) {
193 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; 193 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl;
194 return 0; 194 return 0;
195 } else if ( !doc ) {
196 owarn << "No valid doc" << oendl;
197 return 0;
195 } 198 }
@@ -219,5 +222,8 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c )
219 QTextParagraph *s = doc ? doc->paragAt( id ) : parag; 222 QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
220 if ( !s ) { 223 if ( !s && doc ) {
221 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl; 224 owarn << "can't locate parag at " << id << ", last parag: " << doc->lastParagraph()->paragId() << "" << oendl;
222 return 0; 225 return 0;
226 } else if ( !doc ) {
227 owarn << "No valid doc" << oendl;
228 return 0;
223 } 229 }
@@ -235,2 +241,5 @@ QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c )
235 c->gotoNextLetter(); 241 c->gotoNextLetter();
242 } else {
243 owarn << "No valid cursor" << oendl;
244 return 0;
236 } 245 }
@@ -1394,6 +1403,17 @@ struct Q_EXPORT QTextDocumentTag {
1394 1403
1395#define NEWPAR do{ if ( !hasNewPar) { \ 1404#define NEWPAR do { \
1405 if ( !hasNewPar) { \
1406 if ( !curpar ) { \
1407 owarn << "no current paragraph" << oendl; \
1408 return; \
1409 } \
1396 if ( !textEditMode && curpar && curpar->length()>1 && curpar->at( curpar->length()-2)->c == QChar_linesep ) \ 1410 if ( !textEditMode && curpar && curpar->length()>1 && curpar->at( curpar->length()-2)->c == QChar_linesep ) \
1397 curpar->remove( curpar->length()-2, 1 ); \ 1411 curpar->remove( curpar->length()-2, 1 ); \
1398 curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); vec = 0;} \ 1412 curpar = createParagraph( this, curpar, curpar->next() ); styles.append( vec ); \
1413 if ( !curpar ) { \
1414 owarn << "failed in creating a new paragraph" << oendl; \
1415 return; \
1416 } \
1417 vec = 0; \
1418 } \
1399 hasNewPar = TRUE; \ 1419 hasNewPar = TRUE; \
@@ -1405,3 +1425,4 @@ struct Q_EXPORT QTextDocumentTag {
1405 space = TRUE; \ 1425 space = TRUE; \
1406 delete vec; vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \ 1426 delete vec; \
1427 vec = new QPtrVector<QStyleSheetItem>( (uint)tags.count() + 1); \
1407 int i = 0; \ 1428 int i = 0; \
@@ -1412,3 +1433,2 @@ struct Q_EXPORT QTextDocumentTag {
1412 1433
1413
1414void QTextDocument::setRichText( const QString &text, const QString &context ) 1434void QTextDocument::setRichText( const QString &text, const QString &context )
@@ -1897,4 +1917,7 @@ void QTextDocument::setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheet
1897 int i, mar; 1917 int i, mar;
1898 QStyleSheetItem* mainStyle = curStyle->size() ? (*curStyle)[curStyle->size()-1] : 0; 1918 QStyleSheetItem* mainStyle = (*curStyle)[curStyle->size()-1];
1899 if ( mainStyle && mainStyle->displayMode() == QStyleSheetItem::DisplayListItem ) 1919 if ( !mainStyle )
1920 return;
1921
1922 if ( mainStyle->displayMode() == QStyleSheetItem::DisplayListItem )
1900 stylesPar->setListItem( TRUE ); 1923 stylesPar->setListItem( TRUE );
@@ -5343,3 +5366,3 @@ int QTextFormatterBreakWords::format( QTextDocument *doc, QTextParagraph *parag,
5343 // ### next line should not be needed 5366 // ### next line should not be needed
5344 if ( painter ) 5367 if ( c && painter )
5345 c->format()->setPainter( painter ); 5368 c->format()->setPainter( painter );
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
index 9069c09..3fd877f 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
@@ -297,2 +297,5 @@ UUIDVector OTSDPAttribute::getAllUUIDs() {
297 297
298 if (!subAttributes)
299 return 0;
300
298 int os; 301 int os;
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index d014378..78a18f7 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -438,3 +438,5 @@ void OIpkgConfigDlg::initData()
438 // Get Ipkg execution options 438 // Get Ipkg execution options
439 int options = m_ipkg->ipkgExecOptions(); 439 int options = 0;
440 if ( m_ipkg )
441 options = m_ipkg->ipkgExecOptions();
440 if ( options & FORCE_DEPENDS ) 442 if ( options & FORCE_DEPENDS )
@@ -452,3 +454,3 @@ void OIpkgConfigDlg::initData()
452 454
453 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); 455 m_optVerboseIpkg->setCurrentItem( ( m_ipkg ? m_ipkg->ipkgExecVerbosity() : 0 ) );
454} 456}