Skip to contentSkip to conversation

tools/mxsimage: Remove fclose on empty FILE pointer

PATCH New Mattias Hansson 1 participant 1 message Nov 19, 2021 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/mxsimage: Remove fclose on empty FILE pointer

If sb_load_cmdfile() fails to open the configuration file it will jump to error handling where the code will try to fclose() the FILE pointer which is NULL causing mkimage to segfault.

This patch removes the fclose() since fopen() always returns NULL instead of the file descriptor when failing.

---
 tools/mxsimage.c | 1 -
 1 file changed, 1 deletion(-)
tools/mxsimage.c +0 -1
index 002f4b525a..c7bd86ce52 100644
@@ -1618,7 +1618,6 @@ static int sb_load_cmdfile(struct sb_image_ctx *ictx)
 	return 0;
 
 err_file:
-	fclose(fp);
 	fprintf(stderr, "ERR: Failed to load file \"%s\"\n",
 		ictx->cfg_filename);
 	return -EINVAL;
Signature · 1 line
2.27.0