diff options
author | Martin Hibdon <mhibdon@google.com> | 2014-09-24 11:25:16 -0700 |
---|---|---|
committer | Martin Hibdon <mhibdon@google.com> | 2014-09-24 11:30:52 -0700 |
commit | 123d40283e1411dcb5fa5def656ad352c101e5d0 (patch) | |
tree | 534e2b06dfde56f0959364fb89e8d0d0fabe91c6 /emailcommon | |
parent | f1b6b3afd97a372ec8492ac97fa5fb49c692da6e (diff) | |
download | android_packages_apps_Email-123d40283e1411dcb5fa5def656ad352c101e5d0.tar.gz android_packages_apps_Email-123d40283e1411dcb5fa5def656ad352c101e5d0.tar.bz2 android_packages_apps_Email-123d40283e1411dcb5fa5def656ad352c101e5d0.zip |
Make sure to close a cursor
b/17570154
Change-Id: I759a116a14784e92e7fa7eb51755ceda3860550e
Diffstat (limited to 'emailcommon')
-rwxr-xr-x | emailcommon/src/com/android/emailcommon/provider/Account.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java index 513390b69..5a3ab7f3a 100755 --- a/emailcommon/src/com/android/emailcommon/provider/Account.java +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java @@ -225,11 +225,17 @@ public final class Account extends EmailContent implements Parcelable { new String[] {AccountColumns._ID}, AccountColumns.EMAIL_ADDRESS + "=?", new String[] {emailAddress}, null); - if (c == null || !c.moveToFirst()) { - return null; + try { + if (c == null || !c.moveToFirst()) { + return null; + } + final long id = c.getLong(c.getColumnIndex(AccountColumns._ID)); + return restoreAccountWithId(context, id, observer); + } finally { + if (c != null) { + c.close(); + } } - final long id = c.getLong(c.getColumnIndex(AccountColumns._ID)); - return restoreAccountWithId(context, id, observer); } @Override |