Fixed defects

List of Defects

Error: CPPCHECK_WARNING (CWE-457): [#def1]
libeconf-0.6.2-build/libeconf-0.6.2/lib/helpers.c:233: error[uninitvar]: Uninitialized variable: copied_fe.quotes
#  231|       copied_fe.comment_after_value = NULL;  
#  232|     copied_fe.line_number = fe.line_number;
#  233|->   return copied_fe;
#  234|   }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def2]
libeconf-0.6.2-build/libeconf-0.6.2/lib/helpers.c: scope_hint: In function ‘cpy_file_entry’
libeconf-0.6.2-build/libeconf-0.6.2/lib/helpers.c:233:10: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*(unsigned char *)((char *)&copied_fe + offsetof(struct file_entry, quotes))’
#  231|       copied_fe.comment_after_value = NULL;  
#  232|     copied_fe.line_number = fe.line_number;
#  233|->   return copied_fe;
#  234|   }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def3]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c: scope_hint: In function ‘readConfigHistoryWithCallback’
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:172:30: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘suffix’
#  170|     if (conf_count == 0)
#  171|     {
#  172|->     char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */
#  173|       if (suffix_d == NULL) {
#  174|         free(*key_files);

Error: COMPILER_WARNING (CWE-457): [#def4]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c: scope_hint: In function ‘readConfigHistoryWithCallback’
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:172:30: warning[-Wmaybe-uninitialized]: ‘suffix’ may be used uninitialized
#  172 |     char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */
#      |                              ^~~~~~~~~~~~~~
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:30:15: note: ‘suffix’ was declared here
#   30 |   const char *suffix, *default_dirs[4] = {NULL, NULL, NULL, NULL};
#      |               ^~~~~~
#  170|     if (conf_count == 0)
#  171|     {
#  172|->     char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */
#  173|       if (suffix_d == NULL) {
#  174|         free(*key_files);

Error: CLANG_WARNING: [#def5]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:172:30: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value
#  170|     if (conf_count == 0)
#  171|     {
#  172|->     char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */
#  173|       if (suffix_d == NULL) {
#  174|         free(*key_files);

Error: CLANG_WARNING: [#def6]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:174:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'configure_dirs'
#  172|       char *suffix_d = malloc (strlen(suffix) + 4); /* + strlen(".d/") */
#  173|       if (suffix_d == NULL) {
#  174|->       free(*key_files);
#  175|         *key_files = NULL;
#  176|         return ECONF_NOMEM;

Error: CPPCHECK_WARNING (CWE-401): [#def7]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:176: error[memleak]: Memory leak: configure_dirs
#  174|         free(*key_files);
#  175|         *key_files = NULL;
#  176|->       return ECONF_NOMEM;
#  177|       }
#  178|       cp = stpcpy(suffix_d, suffix);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def8]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:201:13: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘suffix’
#  199|     while (default_dirs[i]) {
#  200|       char *project_path = combine_strings(default_dirs[i], config_name, '/');
#  201|->     error = traverse_conf_dirs(key_files, configure_dirs, size, project_path,
#  202|   			       suffix, delim, comment, callback, callback_data);
#  203|       free(project_path);

Error: CLANG_WARNING: [#def9]
libeconf-0.6.2-build/libeconf-0.6.2/lib/readconfig.c:201:13: warning[core.CallAndMessage]: 5th function call argument is an uninitialized value
#  199|     while (default_dirs[i]) {
#  200|       char *project_path = combine_strings(default_dirs[i], config_name, '/');
#  201|->     error = traverse_conf_dirs(key_files, configure_dirs, size, project_path,
#  202|   			       suffix, delim, comment, callback, callback_data);
#  203|       free(project_path);

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-215.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namelibeconf-0.6.2-2.fc41
diffbase-store-results-to/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.tar.xz
diffbase-time-created2024-07-03 14:41:23
diffbase-time-finished2024-07-03 14:42:21
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpz5zk8b5m/libeconf-0.6.2-2.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-215.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibeconf-0.6.2-1.fc40
store-results-to/tmp/tmpky6ij_am/libeconf-0.6.2-1.fc40.tar.xz
time-created2024-07-03 14:39:42
time-finished2024-07-03 14:41:02
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpky6ij_am/libeconf-0.6.2-1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpky6ij_am/libeconf-0.6.2-1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9