Task #103299 - added.err

back to task #103299
download
Error: CPPCHECK_WARNING (CWE-398):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:125: style[constVariablePointer]: Variable 'entry' can be declared as pointer to const
#  123|   
#  124|   int rmdir_force_recursive(const char *dirname) {
#  125|->     struct dirent *entry;
#  126|       DIR *dp = NULL;
#  127|   

Error: CPPCHECK_WARNING (CWE-398):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:187: style[constVariable]: Variable 'test_confd_temp_dir_templ' can be declared as const array
#  185|   int test_confd_setup(const char *copy_config_file) {
#  186|       FILE *src = NULL;
#  187|->     char test_confd_temp_dir_templ[] = "/tmp/avahi-daemon-test.XXXXXX";
#  188|       size_t BUFFER_SIZE = 64*1024; /* 64k ought to be enough to anyone */
#  189|       char buffer[BUFFER_SIZE];

Error: CLANG_WARNING:
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:197:13: warning[unix.Errno]: An undefined value may be read from 'errno'
#  195|       snprintf(test_confd_temp_dir, sizeof(test_confd_temp_dir), "%s", test_confd_temp_dir_templ);
#  196|       if (mkdtemp(test_confd_temp_dir) == NULL) {
#  197|->         if (errno == EEXIST)
#  198|               fprintf(stderr, "error: dir '%s' already exists\n", test_confd_temp_dir);
#  199|           else

Error: GCC_ANALYZER_WARNING (CWE-775):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c: scope_hint: In function ‘test_confd_setup’
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:214:8: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(copy_config_file, "rb")’
#  212|       }
#  213|       fread_ret = fread(buffer, sizeof(char), BUFFER_SIZE, src);
#  214|->     if (ferror(src)) {
#  215|           fprintf(stderr, "error: reading main config file '%s': %s\n", copy_config_file, strerror(errno));
#  216|           return 1;

Error: GCC_ANALYZER_WARNING (CWE-401):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:214:8: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(copy_config_file, "rb")’
#  212|       }
#  213|       fread_ret = fread(buffer, sizeof(char), BUFFER_SIZE, src);
#  214|->     if (ferror(src)) {
#  215|           fprintf(stderr, "error: reading main config file '%s': %s\n", copy_config_file, strerror(errno));
#  216|           return 1;

Error: CLANG_WARNING:
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:215:9: warning[unix.Stream]: Opened stream never closed. Potential resource leak
#  213|       fread_ret = fread(buffer, sizeof(char), BUFFER_SIZE, src);
#  214|       if (ferror(src)) {
#  215|->         fprintf(stderr, "error: reading main config file '%s': %s\n", copy_config_file, strerror(errno));
#  216|           return 1;
#  217|       }

Error: CPPCHECK_WARNING (CWE-404):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:216: error[resourceLeak]: Resource leak: src
#  214|       if (ferror(src)) {
#  215|           fprintf(stderr, "error: reading main config file '%s': %s\n", copy_config_file, strerror(errno));
#  216|->         return 1;
#  217|       }
#  218|       fclose(src);

Error: CPPCHECK_WARNING (CWE-686):
avahi-0.9.rc3/avahi-daemon/ini-file-parser-test.c:223: portability[invalidPrintfArgType_sint]: %zi in format string (no. 2) requires 'ssize_t' but the argument type is 'size_t {aka unsigned long}'.
#  221|           return 1;
#  222|       } else if (fread_ret >= (int)BUFFER_SIZE) {
#  223|->         fprintf(stderr, "error: reading main config file '%s' exceeded main buffer size %zi\n", copy_config_file, BUFFER_SIZE);
#  224|           return 1;
#  225|       }

Error: CPPCHECK_WARNING (CWE-563):
avahi-0.9.rc3/avahi-daemon/ini-file-parser.c:65: style[unreadVariable]: Variable 'filename_len' is assigned a value that is never used.
#   63|   
#   64|   char** avahi_ini_list_confd_files_sorted(const char* confd_path, int* confd_file_count) {
#   65|->     int filename_len = 0;
#   66|       int suffix_len = 0;
#   67|       const char *suffix = ".conf";

Error: CPPCHECK_WARNING (CWE-398):
avahi-0.9.rc3/avahi-daemon/ini-file-parser.c:65: style[variableScope]: The scope of the variable 'filename_len' can be reduced.
#   63|   
#   64|   char** avahi_ini_list_confd_files_sorted(const char* confd_path, int* confd_file_count) {
#   65|->     int filename_len = 0;
#   66|       int suffix_len = 0;
#   67|       const char *suffix = ".conf";

Error: CPPCHECK_WARNING (CWE-398):
avahi-0.9.rc3/avahi-daemon/ini-file-parser.c:626: style[variableScope]: The scope of the variable 't' can be reduced.
#  624|                       c->server_config.add_service_cookie = is_yes(p->value);
#  625|                   else if (strcasecmp(p->key, "publish-dns-servers") == 0) {
#  626|->                     char **e, **t;
#  627|   
#  628|                       avahi_log_debug("publish-dns-servers: processing line: '%s'", p->value);