system/corennnnn
修訂 | f422f00e56c3d2cdebfdbfaba0781e28e13f31a5 (tree) |
---|---|
時間 | 2016-11-14 03:14:49 |
作者 | Michael W <baddaemon87@gmai...> |
Commiter | Luca Stefani |
init: Fix possible open file pointer
In error case the file is not closed properly.
Add close() before return
Change-Id: Ie1755987859a576045c786105404957d94f0b39d
(cherry picked from commit 656154a5b4127370f7317852e224a9121c6beed3)
@@ -541,8 +541,10 @@ static int charging_mode_booting(void) { | ||
541 | 541 | if (f < 0) |
542 | 542 | return 0; |
543 | 543 | |
544 | - if (1 != read(f, (void *)&cmb,1)) | |
544 | + if (1 != read(f, (void *)&cmb,1)) { | |
545 | + close(f); | |
545 | 546 | return 0; |
547 | + } | |
546 | 548 | |
547 | 549 | close(f); |
548 | 550 | return ('1' == cmb); |