From e5c4073ae836cd049a4bc3d6c1291a25f88ad67d Mon Sep 17 00:00:00 2001 From: lixiaokeng Date: Thu, 4 Jun 2020 20:35:18 +0800 Subject: [PATCH] iscsi: fix fd leak iscsi-review/utils/fwparam_ibft/fwparam_ibft.c: line 466 Before return -1, the fd was opend and not closed which would lead to leak fd. Fix that. Source Link: https://github.com/open-iscsi/open-iscsi/pull/212 Signed-off-by: lixiaokeng Reported-by: Zhiqiang Liu --- utils/fwparam_ibft/fwparam_ibft.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/fwparam_ibft/fwparam_ibft.c b/utils/fwparam_ibft/fwparam_ibft.c index 52edac1..e68e503 100644 --- a/utils/fwparam_ibft/fwparam_ibft.c +++ b/utils/fwparam_ibft/fwparam_ibft.c @@ -463,6 +463,7 @@ fwparam_ibft(struct boot_context *context, const char *filepath) if (stat(filename, &buf)!=0) { fprintf(stderr, "Could not stat file %s: %s (%d)\n", filename, strerror(errno), errno); + close(fd); return -1; } /* And if not zero use that size */ -- 2.21.1 (Apple Git-122.3)