system/core
Révision | 656154a5b4127370f7317852e224a9121c6beed3 (tree) |
---|---|
l'heure | 2016-11-13 21:03:50 |
Auteur | Michael W <baddaemon87@gmai...> |
Commiter | Michael W |
init: Fix possible open file pointer
In error case the file is not closed properly.
Add close() before return
Change-Id: Ie1755987859a576045c786105404957d94f0b39d
@@ -1012,8 +1012,10 @@ static int charging_mode_booting(void) { | ||
1012 | 1012 | if (f < 0) |
1013 | 1013 | return 0; |
1014 | 1014 | |
1015 | - if (1 != read(f, (void *)&cmb,1)) | |
1015 | + if (1 != read(f, (void *)&cmb,1)) { | |
1016 | + close(f); | |
1016 | 1017 | return 0; |
1018 | + } | |
1017 | 1019 | |
1018 | 1020 | close(f); |
1019 | 1021 | return ('1' == cmb); |