Skip to content

Commit

Permalink
lib: fix uninitialized variable
Browse files Browse the repository at this point in the history
```
Error: UNINIT (CWE-457):
libeconf-0.4.1/lib/libeconf.c:161: var_decl: Declaring variable "key_file" without initializer.
libeconf-0.4.1/lib/libeconf.c:247: uninit_use_in_call: Using uninitialized value "key_file" when calling "econf_freeFile".
245|     *key_files = calloc(*size, sizeof(econf_file*));
246|     if (*key_files == NULL) {
247|->     econf_freeFile(key_file);
248|       return ECONF_NOMEM;
249|     }
```

Resolves: https://issues.redhat.com/browse/RHEL-24989

Signed-off-by: Iker Pedrosa <[email protected]>
  • Loading branch information
ikerexxe committed Mar 4, 2024
1 parent 60b5fd9 commit 4bfff05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/readconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ econf_err readConfigHistoryWithCallback(econf_file ***key_files,
{
const char *suffix, *default_dirs[4] = {NULL, NULL, NULL, NULL};
char *distfile, *runfile, *etcfile, *cp;
econf_file *key_file;
econf_file *key_file = NULL;
econf_err error;

*size = 0;
Expand Down

0 comments on commit 4bfff05

Please sign in to comment.