summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/loginwindowimpl.cpp25
-rw-r--r--noncore/apps/opie-reader/Bkmks.cpp1
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
@@ -220,40 +220,57 @@ public:
220 } 220 }
221 221
222private: 222private:
223 bool m_visible; 223 bool m_visible;
224}; 224};
225 225
226void LoginWindowImpl::login ( ) 226void LoginWindowImpl::login ( )
227{ 227{
228 const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); 228 char *const user = ::strdup ( m_user-> currentText ( ). local8Bit ( ));
229 const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); 229 char *pass = ::strdup ( m_password-> text ( ). local8Bit ( ));
230 230
231 if ( !user || !user [0] ) 231 if ( !user ) {
232 if ( pass )
233 free( pass );
232 return; 234 return;
233 if ( !pass ) 235 }
236 if ( !user [0] ) {
237 free( user );
238 if ( pass )
239 free( pass );
240 return;
241 }
242 bool passwordIsEmpty = false;
243 if ( !pass ) {
244 passwordIsEmpty = true;
234 pass = ""; 245 pass = "";
246 }
235 247
236 if ( lApp-> checkPassword ( user, pass )) { 248 if ( lApp-> checkPassword ( user, pass )) {
249 if ( !passwordIsEmpty )
250 free(pass);
237 Config cfg ( "opie-login" ); 251 Config cfg ( "opie-login" );
238 cfg. setGroup ( "General" ); 252 cfg. setGroup ( "General" );
239 cfg. writeEntry ( "LastLogin", user ); 253 cfg. writeEntry ( "LastLogin", user );
240 cfg. write ( ); 254 cfg. write ( );
241 255
242 lApp-> setLoginAs ( user ); 256 lApp-> setLoginAs ( user );
243 257
244 // Draw a big wait icon, the image can be altered in later revisions 258 // Draw a big wait icon, the image can be altered in later revisions
245 m_input-> hideInputMethod ( ); 259 m_input-> hideInputMethod ( );
246 new WaitLogo ( ); 260 new WaitLogo ( );
247 // WaitLogo::showEvent() calls qApp-> quit() 261 // WaitLogo::showEvent() calls qApp-> quit()
248 } 262 }
249 else { 263 else {
250 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); 264 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." ));
251 m_password-> clear ( ); 265 m_password-> clear ( );
266 free( user );
267 if ( !passwordIsEmpty )
268 free( pass );
252 } 269 }
253} 270}
254 271
255void LoginWindowImpl::showPasswordDialog() { 272void LoginWindowImpl::showPasswordDialog() {
256 PasswordDialogImpl dia( this ); 273 PasswordDialogImpl dia( this );
257 dia.showMaximized(); 274 dia.showMaximized();
258 dia.exec(); 275 dia.exec();
259} 276}
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
@@ -314,16 +314,17 @@ Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f)
314 314
315 ln = 0; 315 ln = 0;
316 tchar* anno = new tchar[ln+1]; 316 tchar* anno = new tchar[ln+1];
317 anno[ln] = 0; 317 anno[ln] = 0;
318 318
319 unsigned int pos; 319 unsigned int pos;
320 fread(&pos,sizeof(pos),1,f); 320 fread(&pos,sizeof(pos),1,f);
321 b = new Bkmk(name,anno,pos); 321 b = new Bkmk(name,anno,pos);
322 delete [] anno;
322 } 323 }
323 } 324 }
324 return b; 325 return b;
325} 326}
326 327
327Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f) 328Bkmk* BkmkFile::read05(BkmkFile* /*_this*/, FILE* f)
328{ 329{
329 Bkmk* b = NULL; 330 Bkmk* b = NULL;