From e272f8fbca892301df0a754823ac556c3a1ca7bf Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 15 Jul 2020 12:04:20 +0100 Subject: [PATCH] mosquitto_pub: Close file on file too large. This wasn't a problem because this error caused the program to exit, so there was no real resource leak. Coverity Scan 1430457. --- client/pub_shared.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/pub_shared.c b/client/pub_shared.c index bc9901db..015c5eb1 100644 --- a/client/pub_shared.c +++ b/client/pub_shared.c @@ -100,6 +100,7 @@ int load_file(const char *filename) fseek(fptr, 0, SEEK_END); flen = ftell(fptr); if(flen > MQTT_MAX_PAYLOAD){ + fclose(fptr); err_printf(&cfg, "Error: File must be less than %u bytes.\n\n", MQTT_MAX_PAYLOAD); free(cfg.message); return 1;