From 16aaf68b1f45db0e93058ed58e942a6d0f21d0d8 Mon Sep 17 00:00:00 2001 From: elegantShock2258 Date: Wed, 13 Oct 2021 12:34:03 +0530 Subject: [PATCH 1/2] FIX: L:222: config may not be initialised. L:585 closed host_model_info so there is no possible resource leak. --- uwufetch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 517833b..ad6be95 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -208,7 +208,7 @@ void parse_config() char homedir[512]; // opening and reading the config file - FILE *config; + FILE *config=NULL; if (config_directory == NULL) { if (getenv("HOME") != NULL) @@ -218,7 +218,7 @@ void parse_config() } } else - config = fopen(config_directory, "r"); + config = fopen(config_directory, "r"); if (config == NULL) return; @@ -581,6 +581,7 @@ void get_info() FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r"); if (!host_model_info) host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r"); + fclose(host_model_info); #ifdef __FREEBSD__ host_model_info = popen("sysctl -a hw.hv_vendor", "r"); while (fgets(line, sizeof(line), host_model_info)) From 15850a51fe5fe68c91473266bec6561db8318783 Mon Sep 17 00:00:00 2001 From: elegantShock2258 Date: Wed, 13 Oct 2021 12:36:13 +0530 Subject: [PATCH 2/2] Fixed some indentation --- uwufetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uwufetch.c b/uwufetch.c index ad6be95..3b2546e 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -218,7 +218,7 @@ void parse_config() } } else - config = fopen(config_directory, "r"); + config = fopen(config_directory, "r"); if (config == NULL) return;