From c114d2f547c386c08b1ea6b9c18f7b5047ca547a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Apr 2024 00:23:40 +0200 Subject: [PATCH] Fix memory sanitizer warning: uninitialized read Memsan complains that uninitialized reads originate because of these warnings. Most of the corresponding variables are actually read into through by libconfig; nevertheless, initializing them should not have a bad side-effect (because the initialized value is overwritten). --- common/config/libconfig/config_libconfig.c | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index c5cdd1972f..b0c3c2c6cf 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -322,19 +322,16 @@ int config_libconfig_set(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix) { config_setting_t *setting; - char *str; - int i,u; - long long int llu; - double dbl; - int rst; - int status=0; - int notfound; - int defval; - int fatalerror=0; - int numdefvals=0; + char *str = NULL; + int u = 0; + long long int llu = 0; + double dbl = 0.0f; + int status = 0; + int fatalerror = 0; + int numdefvals = 0; char cfgpath[512]; /* 512 should be enough for the sprintf below */ - for(i=0; i