[mISDNuser PATCH 2/3] Fix file descriptor leak on error

Thomas Jarosch <[email protected]>
Newsgroups gmane.linux.isdn.i4l.user
Organization Intra2net AG
Message-ID <[email protected]>
cppcheck reported:
[capi20/faxl3.c:207]: (error) Resource leak: fd

Signed-off-by: Thomas Jarosch <[email protected]>
---
 capi20/faxl3.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/capi20/faxl3.c b/capi20/faxl3.c
index cfcabfd..0ee8539 100644
--- a/capi20/faxl3.c
+++ b/capi20/faxl3.c
@@ -204,6 +204,7 @@ static int FaxPrepareReceivedTiff(struct fax *fax)
 	if (ret) {
 		fax->b3transfer_error = errno;
 		wprint("NCCI %06x: Cannot fstat received file %s - %s\n", ncci->ncci, fax->file_name, strerror(fax->b3transfer_error));
+		close(fd);
 		return -fax->b3transfer_error;
 	}
 	fax->b3data_size = fst.st_size;
@@ -211,6 +212,7 @@ static int FaxPrepareReceivedTiff(struct fax *fax)
 	if (!fax->b3data) {
 		fax->b3transfer_error = errno;
 		wprint("NCCI %06x: Cannot map received file %s - %s\n", ncci->ncci, fax->file_name, strerror(fax->b3transfer_error));
+		close(fd);
 		return -fax->b3transfer_error;
 	}
 	fax->b3data_mapped = 1;
-- 
1.7.4.4

_______________________________________________
isdn4linux mailing list
[email protected]
https://www.isdn4linux.de/mailman/listinfo/isdn4linux
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.