# authselect-1.7.0-1.20260116093730234883.master.0.g96d286f - findings not occurring in authselect-1.7.0-1.20260116093730234883.master.0.g96d286f

## List of Findings

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘activate’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:174:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:32: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/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): [#def2]
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:182:20: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/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): [#def3]
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘requirements’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:520:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/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): [#def4]
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:528:20: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/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): [#def5]
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c: scope_hint: In function ‘test’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:605:11: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/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): [#def6]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:27: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c: scope_hint: In function 'authselect_profile_open'
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:64:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'dirfd'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:133:13: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/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): [#def7]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:28: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c: scope_hint: In function 'authselect_system_read_templates'
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:64:5: warning[-Wanalyzer-malloc-leak]: leak of 'templates'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:55:17: note: in expansion of macro 'malloc_zero'
    authselect-1.7.0-build/authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:74:9: note: in expansion of macro 'INFO'
    authselect-1.7.0-build/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): [#def8]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c: scope_hint: In function 'textfile_write'
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filepath, "w")'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/common/errno_t.h:24: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:29: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def9]
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'file'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:56:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def10]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c:31: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c: scope_hint: In function 'file_get_parent_directory'
    authselect-1.7.0-build/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-build/authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c:313:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def11]
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filepath, "w")'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c:167:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def12]
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'name'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c:222:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def13]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:28: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of 'output'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/common/gettext.h:25: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:30: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:450:9: note: in expansion of macro 'ERROR'
    authselect-1.7.0-build/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): [#def14]
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:72:5: warning[-Wanalyzer-malloc-leak]: leak of ‘features’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:42:22: note: in definition of macro ‘malloc_zero_array’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:83:16: note: in expansion of macro ‘malloc_zero_array’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
    authselect-1.7.0-build/authselect-1.7.0/src/cli/main.c:176:9: note: in expansion of macro ‘ERROR’
    authselect-1.7.0-build/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): [#def15]
    authselect-1.7.0-build/authselect-1.7.0/src/common/debug.c: scope_hint: In function 'debug'
    authselect-1.7.0-build/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): [#def16]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/config.c: scope_hint: In function 'authselect_config_read_features'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/config.c:44:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*<unknown>)'
    authselect-1.7.0-build/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): [#def17]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/config.c:50:23: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*<unknown>)'
    authselect-1.7.0-build/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): [#def18]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:76:15: warning[-Wanalyzer-malloc-leak]: leak of 'templates'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:55:17: note: in expansion of macro 'malloc_zero'
    authselect-1.7.0-build/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): [#def19]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c: scope_hint: In function 'authselect_system_generate'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:131:30: warning[-Wanalyzer-malloc-leak]: leak of 'files'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/files/system.c:107:13: note: in expansion of macro 'malloc_zero'
    authselect-1.7.0-build/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): [#def20]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/profiles/read.c: scope_hint: In function 'authselect_profile_read_readme'
    authselect-1.7.0-build/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): [#def21]
    authselect-1.7.0-build/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): [#def22]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/evaluator.c: scope_hint: In function 'evaluator_get_feature.part.0'
    authselect-1.7.0-build/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): [#def23]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/evaluator.c:187:20: warning[-Wanalyzer-malloc-leak]: leak of 'evaluator'
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/evaluator.c:30: included_from: Included from here.
    authselect-1.7.0-build/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): [#def24]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/evaluator.c:192:16: warning[-Wanalyzer-malloc-leak]: leak of 'evaluator'
    authselect-1.7.0-build/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): [#def25]
    authselect-1.7.0-build/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-build/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): [#def26]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c: scope_hint: In function 'file_copy.part.0'
    authselect-1.7.0-build/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-build/authselect-1.7.0/src/common/errno_t.h:24: included_from: Included from here.
    authselect-1.7.0-build/authselect-1.7.0/src/common/common.h:29: included_from: Included from here.
    authselect-1.7.0-build/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): [#def27]
    authselect-1.7.0-build/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-build/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): [#def28]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/file.c:521:40: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(source, "r")'
    authselect-1.7.0-build/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): [#def29]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/string.c: scope_hint: In function 'string_explode_add_value'
    authselect-1.7.0-build/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-build/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): [#def30]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/string_array.c: scope_hint: In function 'string_array_free.part.0'
    authselect-1.7.0-build/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-build/authselect-1.7.0/src/lib/util/string_array.c:28: included_from: Included from here.
    authselect-1.7.0-build/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): [#def31]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/string_array.c: scope_hint: In function 'string_array_del_value'
    authselect-1.7.0-build/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-build/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): [#def32]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_process_operators'
    authselect-1.7.0-build/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): [#def33]
    authselect-1.7.0-build/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): [#def34]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:451:9: warning[-Wanalyzer-malloc-leak]: leak of 'output'
    authselect-1.7.0-build/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): [#def35]
    authselect-1.7.0-build/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): [#def36]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c: scope_hint: In function 'template_write'
    authselect-1.7.0-build/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-build/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): [#def37]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/template.c:688:11: warning[-Wanalyzer-malloc-leak]: leak of 'output'
    authselect-1.7.0-build/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): [#def38]
    authselect-1.7.0-build/authselect-1.7.0/src/lib/util/textfile.c: scope_hint: In function 'textfile_read_content'
    authselect-1.7.0-build/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): [#def39]
    authselect-1.7.0-build/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): [#def40]
    authselect-1.7.0-build/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): [#def41]
    authselect-1.7.0-build/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): [#def42]
    authselect-1.7.0-build/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): [#def43]
    authselect-1.7.0-build/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): [#def44]
    authselect-1.7.0-build/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): [#def45]
    authselect-1.7.0-build/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): [#def46]
    authselect-1.7.0-build/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);

## Scan Properties

analyzer-version-clippy | 1.92.0
analyzer-version-cppcheck | 2.19.1
analyzer-version-gcc | 16.0.1
analyzer-version-gcc-analyzer | 16.0.1
analyzer-version-shellcheck | 0.11.0
analyzer-version-unicontrol | 0.0.2
diffbase-analyzer-version-clippy | 1.92.0
diffbase-analyzer-version-cppcheck | 2.19.1
diffbase-analyzer-version-gcc | 16.0.1
diffbase-analyzer-version-gcc-analyzer | 16.0.1
diffbase-analyzer-version-shellcheck | 0.11.0
diffbase-analyzer-version-unicontrol | 0.0.2
diffbase-enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code | 0
diffbase-host | ip-172-16-1-208.us-west-2.compute.internal
diffbase-known-false-positives | /usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpm | known-false-positives-0.0.0.20260115.191212.ge69ffd8.main-1.el9.noarch
diffbase-mock-config | fedora-rawhide-x86_64
diffbase-project-name | authselect-1.7.0-1.20260116093730234883.master.0.g96d286f
diffbase-store-results-to | /tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.tar.xz
diffbase-time-created | 2026-01-16 10:55:28
diffbase-time-finished | 2026-01-16 10:58:14
diffbase-tool | csmock
diffbase-tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.src.rpm'
diffbase-tool-version | csmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol
exit-code | 0
host | ip-172-16-1-208.us-west-2.compute.internal
known-false-positives | /usr/share/csmock/known-false-positives.js
known-false-positives-rpm | known-false-positives-0.0.0.20260115.191212.ge69ffd8.main-1.el9.noarch
mock-config | fedora-rawhide-x86_64
project-name | authselect-1.7.0-1.20260116093730234883.master.0.g96d286f
store-results-to | /tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.tar.xz
time-created | 2026-01-16 10:55:28
time-finished | 2026-01-16 10:58:14
tool | csmock
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmp8ik9o5zx/authselect-1.7.0-1.20260116093730234883.master.0.g96d286f.src.rpm'
tool-version | csmock-3.8.3.20251215.161544.g62de9a5-1.el9