diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-10-09 15:24:53 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-10-09 15:25:23 -0700 |
commit | 1d8e7d640ad5ed6fe82bca017293dd89169f1c2e (patch) | |
tree | 18da7d4acfdf4dae7d34fbdec85b764b872da77a /packages/SettingsProvider | |
parent | d5875d98f06817f78bd974842a8a9c2d41802d20 (diff) | |
download | frameworks_base-1d8e7d640ad5ed6fe82bca017293dd89169f1c2e.zip frameworks_base-1d8e7d640ad5ed6fe82bca017293dd89169f1c2e.tar.gz frameworks_base-1d8e7d640ad5ed6fe82bca017293dd89169f1c2e.tar.bz2 |
Fix Cursor leak in SettingsBackupAgent.
Bug: 5434060
Change-Id: I805695a30d6778d0c7302e63bcfe3dc1a38488f4
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index b851ab7..2444829 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -350,16 +350,21 @@ public class SettingsBackupAgent extends BackupAgentHelper { private byte[] getSystemSettings() { Cursor cursor = getContentResolver().query(Settings.System.CONTENT_URI, PROJECTION, null, null, null); - byte[] result = extractRelevantValues(cursor, Settings.System.SETTINGS_TO_BACKUP); - cursor.close(); - return result; + try { + return extractRelevantValues(cursor, Settings.System.SETTINGS_TO_BACKUP); + } finally { + cursor.close(); + } } private byte[] getSecureSettings() { Cursor cursor = getContentResolver().query(Settings.Secure.CONTENT_URI, PROJECTION, null, null, null); - byte[] result = extractRelevantValues(cursor, Settings.Secure.SETTINGS_TO_BACKUP); - return result; + try { + return extractRelevantValues(cursor, Settings.Secure.SETTINGS_TO_BACKUP); + } finally { + cursor.close(); + } } private void restoreSettings(BackupDataInput data, Uri contentUri) { |