Error: SHELLCHECK_WARNING (CWE-758):
/etc/bash_completion.d/authselect-completion.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> #
#    2|   #    Authors:
#    3|   #        Tomas Halman <thalman@redhat.com>

Error: SHELLCHECK_WARNING (CWE-140):
/etc/bash_completion.d/authselect-completion.sh:199:24: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  197|       if [[ "$possibleopts" != "" ]]; then
#  198|           if [[ "${COMP_WORDS[$COMP_CWORD]}" = "=" ]]; then
#  199|->             COMPREPLY=($(compgen -W "$possibleopts"))
#  200|           else
#  201|               COMPREPLY=($(compgen -W "$possibleopts" -- "${COMP_WORDS[$COMP_CWORD]}"))

Error: SHELLCHECK_WARNING (CWE-140):
/etc/bash_completion.d/authselect-completion.sh:201:24: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  199|               COMPREPLY=($(compgen -W "$possibleopts"))
#  200|           else
#  201|->             COMPREPLY=($(compgen -W "$possibleopts" -- "${COMP_WORDS[$COMP_CWORD]}"))
#  202|           fi
#  203|       else

Error: SHELLCHECK_WARNING (CWE-569):
/etc/bash_completion.d/authselect-completion.sh:206:26: warning[SC2124]: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
#  204|           command="$(get_command)"
#  205|           if [[ "$command" = "" ]]; then
#  206|->             possibleopts="$(get_global_options) ${COMMANDS[@]}"
#  207|           else
#  208|               possibleopts="$(get_global_options) $(get_command_params) $(get_command_keywords) $(get_command_options)"

Error: SHELLCHECK_WARNING (CWE-140):
/etc/bash_completion.d/authselect-completion.sh:210:20: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  208|               possibleopts="$(get_global_options) $(get_command_params) $(get_command_keywords) $(get_command_options)"
#  209|           fi
#  210|->         COMPREPLY=($(compgen -W "$possibleopts" -- "${COMP_WORDS[$COMP_CWORD]}"))
#  211|       fi
#  212|   }

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘activate’
authselect-1.7.0/src/cli/main.c:174:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/cli/main.c:32: included_from: Included from here.
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
#  172|       }
#  173|   
#  174|->     ret = authselect_profile(profile_id, &profile);
#  175|       if (ret != EOK) {
#  176|           ERROR("Unable to get profile information [%d]: %s",

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/cli/main.c:182:20: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
#  180|       }
#  181|   
#  182|->     requirements = authselect_profile_requirements(profile, features);
#  183|       if (requirements == NULL) {
#  184|           ERROR("Unable to read profile requirements!");

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘requirements’
authselect-1.7.0/src/cli/main.c:520:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
#  518|       }
#  519|   
#  520|->     ret = authselect_profile(profile_id, &profile);
#  521|       if (ret != EOK) {
#  522|           ERROR("Unable to get profile information [%d]: %s",

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/cli/main.c:528:20: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
#  526|       }
#  527|   
#  528|->     requirements = authselect_profile_requirements(profile, features);
#  529|       if (requirements == NULL) {
#  530|           ERROR("Unable to read profile requirements!");

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘test’
authselect-1.7.0/src/cli/main.c:605:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
#  603|       }
#  604|   
#  605|->     ret = authselect_files(profile_id, features, &files);
#  606|       if (ret != EOK) {
#  607|           ERROR("Unable to get generated content [%d]: %s", ret, strerror(ret));

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/profiles/read.c:27: included_from: Included from here.
authselect-1.7.0/src/lib/profiles/read.c: scope_hint: In function 'authselect_profile_open'
authselect-1.7.0/src/common/common.h:64:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dirfd'
authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
#   62|   
#   63|   #define INFO(fmt, ...)                                                        \
#   64|->     debug(AUTHSELECT_INFO, __FILE__, __LINE__, __FUNCTION__,                  \
#   65|             gettext(fmt), ## __VA_ARGS__)
#   66|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/files/system.c:28: included_from: Included from here.
authselect-1.7.0/src/lib/files/system.c: scope_hint: In function 'authselect_system_read_templates'
authselect-1.7.0/src/common/common.h:64:5: warning[-Wanalyzer-malloc-leak]: leak of 'templates'
authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
authselect-1.7.0/src/lib/files/system.c:55:17: note: in expansion of macro 'malloc_zero'
authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
#   62|   
#   63|   #define INFO(fmt, ...)                                                        \
#   64|->     debug(AUTHSELECT_INFO, __FILE__, __LINE__, __FUNCTION__,                  \
#   65|             gettext(fmt), ## __VA_ARGS__)
#   66|   

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/textfile.c: scope_hint: In function 'textfile_write'
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filepath, "w")'
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/common/errno_t.h:24: included_from: Included from here.
authselect-1.7.0/src/common/common.h:29: included_from: Included from here.
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'file'
authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/file.c:31: included_from: Included from here.
authselect-1.7.0/src/lib/util/file.c: scope_hint: In function 'file_get_parent_directory'
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'file_get_parent_directory(path)'
authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filepath, "w")'
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'name'
authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c:28: included_from: Included from here.
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'output'
authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
#   70|   
#   71|   #define ERROR(fmt, ...)                                                       \
#   72|->     debug(AUTHSELECT_ERROR, __FILE__, __LINE__, __FUNCTION__,                 \
#   73|             gettext(fmt), ## __VA_ARGS__)
#   74|   

Error: GCC_ANALYZER_WARNING (CWE-404):
authselect-1.7.0/src/common/debug.c: scope_hint: In function 'debug'
authselect-1.7.0/src/common/debug.c:48:11: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
#   46|   
#   47|       va_start(va, fmt);
#   48|->     msg = vaformat(fmt, va);
#   49|       va_end(va);
#   50|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/files/config.c: scope_hint: In function 'authselect_config_read_features'
authselect-1.7.0/src/lib/files/config.c:44:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*<unknown>)'
authselect-1.7.0/src/lib/files/config.c: scope_hint: In function 'authselect_config_read_features'
#   42|   
#   43|   
#   44|->     features = string_array_create(0);
#   45|       if (features == NULL) {
#   46|           return NULL;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/files/config.c:50:23: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*<unknown>)'
authselect-1.7.0/src/lib/files/config.c: scope_hint: In function 'authselect_config_read_features'
#   48|   
#   49|       /* Skip profile name. */
#   50|->     for (i = 1; config[i] != NULL; i++) {
#   51|           features = string_array_add_value(features, config[i], true);
#   52|           if (features == NULL) {

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/files/system.c:76:15: warning[-Wanalyzer-malloc-leak]: leak of 'templates'
authselect-1.7.0/src/lib/files/system.c:55:17: note: in expansion of macro 'malloc_zero'
authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
#   74|           INFO("Reading file [%s/%s]", dirname, paths[i].path);
#   75|   
#   76|->         ret = textfile_read_dirfd(dirfd, dirname, paths[i].path,
#   77|                                     AUTHSELECT_FILE_SIZE_LIMIT,
#   78|                                     paths[i].content);

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/files/system.c: scope_hint: In function 'authselect_system_generate'
authselect-1.7.0/src/lib/files/system.c:131:30: warning[-Wanalyzer-malloc-leak]: leak of 'files'
authselect-1.7.0/src/lib/files/system.c:107:13: note: in expansion of macro 'malloc_zero'
authselect-1.7.0/src/lib/files/system.c:107:13: note: in expansion of macro 'malloc_zero'
#  129|           }
#  130|   
#  131|->         *tpls[i].generated = template_generate(tpls[i].template, features);
#  132|           if (tpls[i].generated == NULL) {
#  133|               ret = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/profiles/read.c: scope_hint: In function 'authselect_profile_read_readme'
authselect-1.7.0/src/lib/profiles/read.c:215:15: warning[-Wanalyzer-malloc-leak]: leak of 'name'
#  213|       }
#  214|   
#  215|->     trimmed = string_trim(name);
#  216|       if (trimmed == NULL) {
#  217|           ret = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/profiles/read.c:221:9: warning[-Wanalyzer-malloc-leak]: leak of 'name'
#  219|       }
#  220|   
#  221|->     if (string_is_empty(trimmed)) {
#  222|           ERROR("Profile [%s] does not contain a name in [%s]!",
#  223|                 location, FILE_README);

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/evaluator.c: scope_hint: In function 'evaluator_get_feature.part.0'
authselect-1.7.0/src/lib/util/evaluator.c:187:20: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#  185|   
#  186|       len = strlen(token) - 2;
#  187|->     feature_name = format("%.*s", len, &token[1]);
#  188|       if (feature_name == NULL) {
#  189|           return ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/evaluator.c:187:20: warning[-Wanalyzer-malloc-leak]: leak of 'evaluator'
authselect-1.7.0/src/lib/util/evaluator.c:30: included_from: Included from here.
authselect-1.7.0/src/lib/util/evaluator.c:518:17: note: in expansion of macro 'malloc_zero'
#  185|   
#  186|       len = strlen(token) - 2;
#  187|->     feature_name = format("%.*s", len, &token[1]);
#  188|       if (feature_name == NULL) {
#  189|           return ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/evaluator.c:192:16: warning[-Wanalyzer-malloc-leak]: leak of 'evaluator'
authselect-1.7.0/src/lib/util/evaluator.c:518:17: note: in expansion of macro 'malloc_zero'
#  190|       }
#  191|   
#  192|->     *_result = string_array_has_value((char **)features, feature_name);
#  193|       free(feature_name);
#  194|   

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/file.c:521:40: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(format("%s/%s", destdir,  destname), "w")'
authselect-1.7.0/src/lib/util/file.c:524:9: note: in expansion of macro 'WARN'
#  519|       /* Restore original owner and mode.  Errors here are not fatal, since we
#  520|        * have the original content already stored and owned by root. */
#  521|->     ret = fchmod(fileno(fdest), statbuf.st_mode & ALLPERMS);
#  522|       if (ret != 0) {
#  523|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/file.c: scope_hint: In function 'file_copy.part.0'
authselect-1.7.0/src/lib/util/file.c:521:40: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(source, "r")'
authselect-1.7.0/src/common/errno_t.h:24: included_from: Included from here.
authselect-1.7.0/src/common/common.h:29: included_from: Included from here.
authselect-1.7.0/src/lib/util/file.c:524:9: note: in expansion of macro 'WARN'
#  519|       /* Restore original owner and mode.  Errors here are not fatal, since we
#  520|        * have the original content already stored and owned by root. */
#  521|->     ret = fchmod(fileno(fdest), statbuf.st_mode & ALLPERMS);
#  522|       if (ret != 0) {
#  523|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/file.c:521:40: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(format("%s/%s", destdir,  destname), "w")'
authselect-1.7.0/src/lib/util/file.c:524:9: note: in expansion of macro 'WARN'
#  519|       /* Restore original owner and mode.  Errors here are not fatal, since we
#  520|        * have the original content already stored and owned by root. */
#  521|->     ret = fchmod(fileno(fdest), statbuf.st_mode & ALLPERMS);
#  522|       if (ret != 0) {
#  523|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/file.c:521:40: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(source, "r")'
authselect-1.7.0/src/lib/util/file.c:524:9: note: in expansion of macro 'WARN'
#  519|       /* Restore original owner and mode.  Errors here are not fatal, since we
#  520|        * have the original content already stored and owned by root. */
#  521|->     ret = fchmod(fileno(fdest), statbuf.st_mode & ALLPERMS);
#  522|       if (ret != 0) {
#  523|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/string.c: scope_hint: In function 'string_explode_add_value'
authselect-1.7.0/src/lib/util/string.c:174:13: warning[-Wanalyzer-malloc-leak]: leak of 'token'
/usr/include/features.h:540: included_from: Included from here.
/usr/include/ctype.h:25: included_from: Included from here.
authselect-1.7.0/src/lib/util/string.c:21: included_from: Included from here.
#  172|       }
#  173|   
#  174|->     array = string_array_add_value(array, token, false);
#  175|       free(token);
#  176|   

Error: GCC_ANALYZER_WARNING (CWE-416):
authselect-1.7.0/src/lib/util/string_array.c: scope_hint: In function 'string_array_free.part.0'
authselect-1.7.0/src/lib/util/string_array.c:100:22: warning[-Wanalyzer-use-after-free]: use after 'reallocarray' of 'array'
authselect-1.7.0/src/lib/util/string_array.c:28: included_from: Included from here.
authselect-1.7.0/src/lib/util/string_array.c:81:19: note: in expansion of macro 'realloc_array'
#   98|       }
#   99|   
#  100|->     for (i = 0; array[i] != NULL; i++) {
#  101|           free(array[i]);
#  102|       }

Error: GCC_ANALYZER_WARNING (CWE-688):
authselect-1.7.0/src/lib/util/string_array.c: scope_hint: In function 'string_array_del_value'
authselect-1.7.0/src/lib/util/string_array.c:189:13: warning[-Wanalyzer-null-argument]: use of NULL '*array' where non-null expected
authselect-1.7.0/src/lib/util/string_array.c:23: included_from: Included from here.
/usr/include/string.h:171:12: note: argument 1 of 'strcmp' must be non-null
#  187|       count = string_array_count(array);
#  188|       for (i = 0; i < count; i++) {
#  189|->         if (strcmp(array[i], value) == 0) {
#  190|               free(array[i]);
#  191|               array[i] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_process_operators'
authselect-1.7.0/src/lib/util/template.c:441:21: warning[-Wanalyzer-malloc-leak]: leak of 'output'
#  439|       int reret;
#  440|   
#  441|->     features_copy = string_array_copy((char**)features, true);
#  442|       if (features_copy == NULL) {
#  443|           return ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c:448:13: warning[-Wanalyzer-malloc-leak]: leak of 'output'
#  446|       orig_len = strlen(content);
#  447|   
#  448|->     reret = regcomp(&regex, OP_RE, REG_EXTENDED | REG_NEWLINE);
#  449|       if (reret != REG_NOERROR) {
#  450|           ERROR("Unable to compile regular expression: regex error %d", reret);

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c:451:9: warning[-Wanalyzer-malloc-leak]: leak of 'output'
authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
#  449|       if (reret != REG_NOERROR) {
#  450|           ERROR("Unable to compile regular expression: regex error %d", reret);
#  451|->         string_array_free(features_copy);
#  452|           return EFAULT;
#  453|       }

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c:456:21: warning[-Wanalyzer-malloc-leak]: leak of 'output'
#  454|   
#  455|       match_string = content;
#  456|->     while ((reret = regexec(&regex, match_string, RE_MATCHES, m, 0)) == REG_NOERROR) {
#  457|           ret = template_process_matches(match_string, m, &op, &expression,
#  458|                                          &if_true, &if_false, &value);

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_write'
authselect-1.7.0/src/lib/util/template.c:680:18: warning[-Wanalyzer-malloc-leak]: leak of 'strdup("# Generated by authselect\012# Do not modify this file manually, use authselect instead. Any user changes will be overwritten.\012# You can stop authselect from managing your configuration by calling \'authselect opt-out\'.\012# See authselect(8) for more details.\012\012")'
authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_write'
#  678|           output = preamble;
#  679|       } else {
#  680|->         output = format("%s%s", preamble, content);
#  681|           free(preamble);
#  682|       }

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/template.c:688:11: warning[-Wanalyzer-malloc-leak]: leak of 'output'
authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_write'
#  686|       }
#  687|   
#  688|->     ret = textfile_write(filepath, output, mode);
#  689|       free(output);
#  690|   

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c: scope_hint: In function 'textfile_read_content'
authselect-1.7.0/src/lib/util/textfile.c:43:11: warning[-Wanalyzer-malloc-leak]: leak of 'file'
#   41|       errno_t ret;
#   42|   
#   43|->     ret = fseek(file, 0, SEEK_END);
#   44|       if (ret != 0) {
#   45|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/textfile.c:44:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filepath, "r")'
#   42|   
#   43|       ret = fseek(file, 0, SEEK_END);
#   44|->     if (ret != 0) {
#   45|           ret = errno;
#   46|           goto done;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c:44:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filepath, "r")'
#   42|   
#   43|       ret = fseek(file, 0, SEEK_END);
#   44|->     if (ret != 0) {
#   45|           ret = errno;
#   46|           goto done;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c:49:15: warning[-Wanalyzer-malloc-leak]: leak of 'file'
#   47|       }
#   48|   
#   49|->     filelen = ftell(file);
#   50|       if (filelen == -1) {
#   51|           ret = errno;

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/textfile.c:50:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filepath, "r")'
#   48|   
#   49|       filelen = ftell(file);
#   50|->     if (filelen == -1) {
#   51|           ret = errno;
#   52|           goto done;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c:50:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filepath, "r")'
#   48|   
#   49|       filelen = ftell(file);
#   50|->     if (filelen == -1) {
#   51|           ret = errno;
#   52|           goto done;

Error: GCC_ANALYZER_WARNING (CWE-775):
authselect-1.7.0/src/lib/util/textfile.c:55:29: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filepath, "r")'
#   53|       }
#   54|   
#   55|->     if (filelen > limit_KiB * 1024) {
#   56|           ERROR("File [%s] is bigger than %uKiB!", filename, limit_KiB);
#   57|           ret = ERANGE;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c:55:29: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filepath, "r")'
#   53|       }
#   54|   
#   55|->     if (filelen > limit_KiB * 1024) {
#   56|           ERROR("File [%s] is bigger than %uKiB!", filename, limit_KiB);
#   57|           ret = ERANGE;

Error: GCC_ANALYZER_WARNING (CWE-401):
authselect-1.7.0/src/lib/util/textfile.c:61:5: warning[-Wanalyzer-malloc-leak]: leak of 'file'
#   59|       }
#   60|   
#   61|->     rewind(file);
#   62|   
#   63|       buffer = malloc_zero_array(char, filelen + 1);
