From 76b1b99717ed76093608eb8c45c0711d4541b2fb Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 30 Aug 2021 10:28:26 -0700 Subject: [PATCH] Make sure config file is closed after dumping configuration --- daemon/x52d_config_dump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/x52d_config_dump.c b/daemon/x52d_config_dump.c index 7569233..02ca884 100644 --- a/daemon/x52d_config_dump.c +++ b/daemon/x52d_config_dump.c @@ -152,11 +152,13 @@ int x52d_config_save_file(struct x52d_config *cfg, const char *cfg_file) if (rc) { \ PINELOG_ERROR(_("Failed to dump %s.%s to config file %s - code %d: %s"), \ #section, #key, cfg_file, rc, strerror(rc)); \ - return rc; \ + goto exit_dump; \ } \ } while (0); #include "x52d_config.def" - return 0; +exit_dump: + fclose(cfg_fp); + return rc; }