summaryrefslogtreecommitdiff
authorerik <erik>2007-01-19 01:20:57 (UTC)
committer erik <erik>2007-01-19 01:20:57 (UTC)
commitf60301bab1f8aa3693089036a3791a01ae6f9db8 (patch) (unidiff)
tree876aef9930a5f85762bcc17e0310921617a568da
parent32343107b30904806d02672955c57ed53d39fe79 (diff)
downloadopie-f60301bab1f8aa3693089036a3791a01ae6f9db8.zip
opie-f60301bab1f8aa3693089036a3791a01ae6f9db8.tar.gz
opie-f60301bab1f8aa3693089036a3791a01ae6f9db8.tar.bz2
core/opie-login/loginwindowimpl.cpp has a fix to properly free strings
that were dup'ed. noncore/apps/opie-reader/Bkmks.cpp deletes a temporary pointer that was not being properly disposed of.
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
@@ -227,11 +227,25 @@ void 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" );
@@ -251,2 +265,5 @@ void LoginWindowImpl::login ( )
251 m_password-> clear ( ); 265 m_password-> clear ( );
266 free( user );
267 if ( !passwordIsEmpty )
268 free( pass );
252 } 269 }
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
@@ -321,2 +321,3 @@ Bkmk* BkmkFile::read03(BkmkFile* /*_this*/, FILE* f)
321 b = new Bkmk(name,anno,pos); 321 b = new Bkmk(name,anno,pos);
322 delete [] anno;
322 } 323 }