author | erik <erik> | 2007-01-19 01:20:57 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-19 01:20:57 (UTC) |
commit | f60301bab1f8aa3693089036a3791a01ae6f9db8 (patch) (unidiff) | |
tree | 876aef9930a5f85762bcc17e0310921617a568da | |
parent | 32343107b30904806d02672955c57ed53d39fe79 (diff) | |
download | opie-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.
-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: | |||
225 | 225 | ||
226 | void LoginWindowImpl::login ( ) | 226 | 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" ); |
238 | cfg. setGroup ( "General" ); | 252 | cfg. setGroup ( "General" ); |
239 | cfg. writeEntry ( "LastLogin", user ); | 253 | cfg. writeEntry ( "LastLogin", user ); |
@@ -249,6 +263,9 @@ void LoginWindowImpl::login ( ) | |||
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 | ||
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) | |||
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; |