-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Bkmks.cpp | 1 |
2 files changed, 22 insertions, 4 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index 547a9b3..b9a286d 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp @@ -225,15 +225,29 @@ private: void LoginWindowImpl::login ( ) { - const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); - const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); + char *const user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); + char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); - if ( !user || !user [0] ) + if ( !user ) { + if ( pass ) + free( pass ); return; - if ( !pass ) + } + if ( !user [0] ) { + free( user ); + if ( pass ) + free( pass ); + return; + } + bool passwordIsEmpty = false; + if ( !pass ) { + passwordIsEmpty = true; pass = ""; + } if ( lApp-> checkPassword ( user, pass )) { + if ( !passwordIsEmpty ) + free(pass); Config cfg ( "opie-login" ); cfg. setGroup ( "General" ); cfg. writeEntry ( "LastLogin", user ); @@ -249,6 +263,9 @@ void LoginWindowImpl::login ( ) else { QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); m_password-> clear ( ); + free( user ); + if ( !passwordIsEmpty ) + free( pass ); } } diff --git a/noncore/apps/opie-reader/Bkmks.cpp b/noncore/apps/opie-reader/Bkmks.cpp index 28f6318..00141a3 100644 --- a/noncore/apps/opie-reader/Bkmks.cpp +++ b/noncore/apps/opie-reader/Bkmks.cpp @@ -319,6 +319,7 @@ Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f) unsigned int pos; fread(&pos,sizeof(pos),1,f); b = new Bkmk(name,anno,pos); + delete [] anno; } } return b; |