From 82607d11dca17baf02028eaaaca6312f8015114f Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Tue, 25 Jul 2023 14:28:10 -0700 Subject: [PATCH] blah --- libclamav/udf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libclamav/udf.c b/libclamav/udf.c index 3836051615..1df4b61a91 100644 --- a/libclamav/udf.c +++ b/libclamav/udf.c @@ -60,14 +60,18 @@ static cl_error_t writeWholeFile(cli_ctx *ctx, const char *const fileName, const } if (cli_writen(fd, data, dataLen) != dataLen) { - cli_warnmsg("iso_scan_file: Can't write to file %s\n", tmpf); + cli_warnmsg("writeWholeFile: Can't write to file %s\n", tmpf); status = CL_EWRITE; goto done; } status = cli_magic_scan_desc(fd, tmpf, ctx, fileName, LAYER_ATTRIBUTES_NONE); - close(fd); +done: + if (-1 != fd){ + close(fd); + fd = -1; + } if (!ctx->engine->keeptmp) { if (cli_unlink(tmpf)) { /* If status is already set to virus or something, that should take priority of the @@ -75,11 +79,9 @@ static cl_error_t writeWholeFile(cli_ctx *ctx, const char *const fileName, const if (CL_CLEAN == status) { status = CL_EUNLINK; } - goto done; } } -done: FREE(tmpf); return status;