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.
This commit is contained in:
Roger A. Light 2020-07-15 12:04:20 +01:00
parent cadcde52a4
commit e272f8fbca

View File

@ -100,6 +100,7 @@ int load_file(const char *filename)
fseek(fptr, 0, SEEK_END); fseek(fptr, 0, SEEK_END);
flen = ftell(fptr); flen = ftell(fptr);
if(flen > MQTT_MAX_PAYLOAD){ if(flen > MQTT_MAX_PAYLOAD){
fclose(fptr);
err_printf(&cfg, "Error: File must be less than %u bytes.\n\n", MQTT_MAX_PAYLOAD); err_printf(&cfg, "Error: File must be less than %u bytes.\n\n", MQTT_MAX_PAYLOAD);
free(cfg.message); free(cfg.message);
return 1; return 1;