Skip to content

Commit ec6dac5

Browse files
de-nordicutzig
authored andcommitted
bootutil: Fix boot_find_status leaving flash area open
The commit fixes boot_find_status leaving flash area object in open state on success. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 482921f commit ec6dac5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

boot/bootutil/src/bootutil_misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,16 @@ boot_find_status(int image_index, const struct flash_area **fap)
224224

225225
off = boot_magic_off(*fap);
226226
rc = flash_area_read(*fap, off, magic, BOOT_MAGIC_SZ);
227+
flash_area_close(*fap);
228+
227229
if (rc != 0) {
228-
flash_area_close(*fap);
229230
return rc;
230231
}
231232

232233
if (memcmp(magic, boot_img_magic, BOOT_MAGIC_SZ) == 0) {
233234
return 0;
234235
}
235236

236-
flash_area_close(*fap);
237237
}
238238

239239
/* If we got here, no magic was found */

0 commit comments

Comments
 (0)