shell: flashdev: close fds on allocation failure

This commit is contained in:
shuhua hua
2026-09-25 02:05:33 +00:00
parent 05bab5136d
commit 124690270d
+6 -1
View File
@@ -312,7 +312,12 @@ int flashdev_shell_write(
/* Create buffer */
buffer = calloc(1, 0x1000);
if (buffer == NULL) {
close(flash);
close(file);
printf("Failed to allocate write buffer\n");
return -1;
}
/* Write file to flash device in 0x1000 byte chunks */
offset = 0;
while (offset != length) {