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).
This commit is contained in:
@@ -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)
|
int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
|
||||||
{
|
{
|
||||||
config_setting_t *setting;
|
config_setting_t *setting;
|
||||||
char *str;
|
char *str = NULL;
|
||||||
int i,u;
|
int u = 0;
|
||||||
long long int llu;
|
long long int llu = 0;
|
||||||
double dbl;
|
double dbl = 0.0f;
|
||||||
int rst;
|
int status = 0;
|
||||||
int status=0;
|
int fatalerror = 0;
|
||||||
int notfound;
|
int numdefvals = 0;
|
||||||
int defval;
|
|
||||||
int fatalerror=0;
|
|
||||||
int numdefvals=0;
|
|
||||||
char cfgpath[512]; /* 512 should be enough for the sprintf below */
|
char cfgpath[512]; /* 512 should be enough for the sprintf below */
|
||||||
|
|
||||||
for(i=0; i<numoptions; i++) {
|
for(int i=0; i<numoptions; i++) {
|
||||||
if (prefix != NULL) {
|
if (prefix != NULL) {
|
||||||
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
|
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
|
||||||
} else {
|
} else {
|
||||||
@@ -346,8 +343,8 @@ int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
notfound=0;
|
int notfound = 0;
|
||||||
defval=0;
|
int defval = 0;
|
||||||
|
|
||||||
switch(cfgoptions[i].type) {
|
switch(cfgoptions[i].type) {
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
@@ -436,7 +433,7 @@ int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions,
|
|||||||
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
|
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
|
||||||
defval = config_setdefault_ipv4addr(cfg, &(cfgoptions[i]), prefix);
|
defval = config_setdefault_ipv4addr(cfg, &(cfgoptions[i]), prefix);
|
||||||
} else {
|
} else {
|
||||||
rst = config_assign_ipv4addr(cfg, cfgoptions, str);
|
int rst = config_assign_ipv4addr(cfg, cfgoptions, str);
|
||||||
|
|
||||||
if (rst < 0) {
|
if (rst < 0) {
|
||||||
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
|
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
|
||||||
|
|||||||
Reference in New Issue
Block a user