Skip to content

Commit 62539e9

Browse files
committed
Close file on exception as well
Bug: 5458045 Change-Id: I4c79b9c273ff69dda292e5cc7b2b60f8db2edbd9
1 parent 2375d16 commit 62539e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

services/java/com/android/server/pm/Settings.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
import java.util.HashSet;
6464
import java.util.Iterator;
6565

66+
import libcore.io.IoUtils;
67+
6668
/**
6769
* Holds information about dynamic settings.
6870
*/
@@ -998,8 +1000,8 @@ void writeLPr() {
9981000
FileUtils.sync(fstr);
9991001
str.close();
10001002
journal.commit();
1001-
}
1002-
catch (Exception e) {
1003+
} catch (Exception e) {
1004+
IoUtils.closeQuietly(str);
10031005
journal.rollback();
10041006
}
10051007

0 commit comments

Comments
 (0)