summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-02-03 22:50:50 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-04 08:21:07 +0100
commit2bc655f5f5d2d485f545a4cd46dd8314ad6b55f1 (patch)
tree6cfda35d13b9a22f43e6b6b0b8cdb0e98ec4fce9
parent84f715cb8cbc21943cb72a1a3c0184d8bdcabb4f (diff)
downloadbarebox-2bc655f5f5d2d485f545a4cd46dd8314ad6b55f1.tar.gz
scripts/kwbimage: Fix resource leak in image_create_payload()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--scripts/kwbimage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index c085d4d..f8abeb1 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -701,18 +701,18 @@ static int image_create_payload(void *payload_start, size_t payloadsz,
if (ret < 0) {
fprintf(stderr, "Cannot stat payload file %s\n",
payload_filename);
+ fclose(payload);
return ret;
}
ret = fread(payload_start, s.st_size, 1, payload);
+ fclose(payload);
if (ret != 1) {
fprintf(stderr, "Cannot read payload file %s\n",
payload_filename);
return -1;
}
- fclose(payload);
-
*payload_checksum = image_checksum32(payload_start, payloadsz);
return 0;
}