Task #91499 - fixed.err
back to task #91499download
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-common.c:41:21: warning[-Wanalyzer-malloc-leak]: leak of ‘full_path(dict_dir, "thbrk", ".tri")’
libthai-0.1.29/src/thbrk/brk-common.c:48:1: enter_function: entry to ‘brk_load_default_dict’
libthai-0.1.29/src/thbrk/brk-common.c:55:8: branch_true: following ‘true’ branch (when ‘dict_dir’ is non-NULL)...
libthai-0.1.29/src/thbrk/brk-common.c:56:22: branch_true: ...to here
libthai-0.1.29/src/thbrk/brk-common.c:56:22: call_function: calling ‘full_path’ from ‘brk_load_default_dict’
libthai-0.1.29/src/thbrk/brk-common.c:56:22: return_function: returning to ‘brk_load_default_dict’ from ‘full_path’
libthai-0.1.29/src/thbrk/brk-common.c:57:21: throw: if ‘trie_new_from_file’ throws an exception...
libthai-0.1.29/src/thbrk/brk-common.c:41:21: danger: ‘full_path(dict_dir, "thbrk", ".tri")’ leaks here; was allocated at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
# 39| full_path (const char *path, const char *name, const char *ext)
# 40| {
# 41|-> int full_size = strlen (path) + strlen (name) + strlen (ext) + 2;
# 42| char *full_path_buff = (char *) malloc (full_size);
# 43| sprintf (full_path_buff, "%s/%s%s", path, name, ext);
Error: GCC_ANALYZER_WARNING (CWE-688):
libthai-0.1.29/src/thbrk/brk-common.c:43:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘full_path_buff’ where non-null expected
libthai-0.1.29/src/thbrk/brk-common.c:42:37: acquire_memory: this call could return NULL
libthai-0.1.29/src/thbrk/brk-common.c:43:5: danger: argument 1 (‘full_path_buff’) from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 41| int full_size = strlen (path) + strlen (name) + strlen (ext) + 2;
# 42| char *full_path_buff = (char *) malloc (full_size);
# 43|-> sprintf (full_path_buff, "%s/%s%s", path, name, ext);
# 44| return full_path_buff;
# 45| }
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:134:5: warning[-Wanalyzer-malloc-leak]: leak of ‘brkpos_hints’
libthai-0.1.29/src/thbrk/brk-maximal.c:131:29: acquire_memory: allocated here
libthai-0.1.29/src/thbrk/brk-maximal.c:132:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:134:5: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:134:5: throw: if ‘brk_brkpos_hints’ throws an exception...
libthai-0.1.29/src/thbrk/brk-maximal.c:134:5: danger: ‘brkpos_hints’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 132| if (UNLIKELY (!brkpos_hints))
# 133| goto err_nothing_done;
# 134|-> brk_brkpos_hints (s, len, brkpos_hints);
# 135|
# 136| ws = (thwchar_t *) malloc ((len + 1) * sizeof (thwchar_t));
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:139:5: warning[-Wanalyzer-malloc-leak]: leak of ‘ws’
libthai-0.1.29/src/thbrk/brk-maximal.c:132:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:134:5: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:136:24: acquire_memory: allocated here
libthai-0.1.29/src/thbrk/brk-maximal.c:137:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:139:5: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:139:5: throw: if ‘th_tis2uni_line’ throws an exception...
libthai-0.1.29/src/thbrk/brk-maximal.c:139:5: danger: ‘ws’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
# 137| if (UNLIKELY (!ws))
# 138| goto err_brkpos_hints_created;
# 139|-> th_tis2uni_line (s, ws, len + 1);
# 140|
# 141| ret = brk_maximal_do_impl (ws, len, brkpos_hints, pos, n, env);
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:438:23: warning[-Wanalyzer-malloc-leak]: leak of ‘node’
libthai-0.1.29/src/thbrk/brk-maximal.c:504:1: enter_function: entry to ‘brk_pool_node_new’
libthai-0.1.29/src/thbrk/brk-maximal.c:508:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:514:28: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:514:28: acquire_memory: allocated here
libthai-0.1.29/src/thbrk/brk-maximal.c:515:12: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:517:13: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:517:13: call_function: calling ‘brk_shot_init’ from ‘brk_pool_node_new’
# 436| brk_shot_init (BrkShot *dst, const BrkShot *src)
# 437| {
# 438|-> dst->dict_state = trie_state_clone (src->dict_state);
# 439| dst->str_pos = src->str_pos;
# 440| dst->brk_pos = (int *) malloc (src->n_brk_pos * sizeof (int));
Error: GCC_ANALYZER_WARNING (CWE-688):
libthai-0.1.29/src/thbrk/brk-maximal.c:443:5: warning[-Wanalyzer-null-argument]: use of NULL ‘root_shot.brk_pos’ where non-null expected
libthai-0.1.29/src/thbrk/brk-maximal.c:374:1: enter_function: entry to ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:384:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:386:39: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:387:5: release_memory: ‘root_shot.brk_pos’ is NULL
libthai-0.1.29/src/thbrk/brk-maximal.c:392:12: call_function: calling ‘brk_pool_node_new’ from ‘brk_root_pool’
# 441| if (UNLIKELY (!dst->brk_pos))
# 442| return -1;
# 443|-> memcpy (dst->brk_pos, src->brk_pos, src->cur_brk_pos * sizeof (int));
# 444| dst->n_brk_pos = src->n_brk_pos;
# 445| dst->cur_brk_pos = src->cur_brk_pos;
Error: GCC_ANALYZER_WARNING (CWE-688):
libthai-0.1.29/src/thbrk/brk-maximal.c:460:5: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libthai-0.1.29/src/thbrk/brk-maximal.c:456:8: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:458:41: branch_true: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:460:13: release_memory: using NULL here
libthai-0.1.29/src/thbrk/brk-maximal.c:460:5: danger: argument 1 (‘*dst.brk_pos’) NULL where non-null expected
# 458| src->n_brk_pos * sizeof (int));
# 459| }
# 460|-> memcpy (dst->brk_pos, src->brk_pos, src->cur_brk_pos * sizeof (int));
# 461| dst->n_brk_pos = src->n_brk_pos;
# 462| dst->cur_brk_pos = src->cur_brk_pos;
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:464:1: warning[-Wanalyzer-malloc-leak]: leak of ‘**env.free_list.shot.brk_pos’
libthai-0.1.29/src/thbrk/brk-maximal.c:504:1: enter_function: entry to ‘brk_pool_node_new’
libthai-0.1.29/src/thbrk/brk-maximal.c:508:8: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:511:26: branch_true: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:512:9: call_function: calling ‘brk_shot_reuse’ from ‘brk_pool_node_new’
# 462| dst->cur_brk_pos = src->cur_brk_pos;
# 463| dst->penalty = src->penalty;
# 464|-> }
# 465|
# 466| static void
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:470:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
libthai-0.1.29/src/thbrk/brk-maximal.c:374:1: enter_function: entry to ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:384:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:386:39: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:392:12: call_function: calling ‘brk_pool_node_new’ from ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:392:12: return_function: returning to ‘brk_root_pool’ from ‘brk_pool_node_new’
libthai-0.1.29/src/thbrk/brk-maximal.c:393:8: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:394:16: call_function: inlined call to ‘brk_pool_add’ from ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:397:5: call_function: calling ‘brk_shot_destruct’ from ‘brk_root_pool’
# 468| {
# 469| if (shot->dict_state)
# 470|-> trie_state_free (shot->dict_state);
# 471| if (shot->brk_pos)
# 472| free (shot->brk_pos);
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/brk-maximal.c:470:9: warning[-Wanalyzer-malloc-leak]: leak of ‘pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:374:1: enter_function: entry to ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:384:8: branch_false: following ‘false’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:386:39: branch_false: ...to here
libthai-0.1.29/src/thbrk/brk-maximal.c:392:12: call_function: calling ‘brk_pool_node_new’ from ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:392:12: return_function: returning to ‘brk_root_pool’ from ‘brk_pool_node_new’
libthai-0.1.29/src/thbrk/brk-maximal.c:393:8: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thbrk/brk-maximal.c:394:16: call_function: inlined call to ‘brk_pool_add’ from ‘brk_root_pool’
libthai-0.1.29/src/thbrk/brk-maximal.c:397:5: call_function: calling ‘brk_shot_destruct’ from ‘brk_root_pool’
# 468| {
# 469| if (shot->dict_state)
# 470|-> trie_state_free (shot->dict_state);
# 471| if (shot->brk_pos)
# 472| free (shot->brk_pos);
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:79:21: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 77| dict_trie = trie_new_from_file (dictpath);
# 78| } else {
# 79|-> dict_trie = brk_load_default_dict ();
# 80| }
# 81| if (UNLIKELY (!dict_trie)) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:79:21: warning[-Wanalyzer-malloc-leak]: leak of ‘brk’
libthai-0.1.29/src/thbrk/thbrk.c:344:1: enter_function: entry to ‘brk_get_shared_brk’
libthai-0.1.29/src/thbrk/thbrk.c:348:8: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thbrk/thbrk.c:349:26: call_function: calling ‘th_brk_new’ from ‘brk_get_shared_brk’
# 77| dict_trie = trie_new_from_file (dictpath);
# 78| } else {
# 79|-> dict_trie = brk_load_default_dict ();
# 80| }
# 81| if (UNLIKELY (!dict_trie)) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:192:36: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 190|
# 191| p = chunk = acronym_end = s;
# 192|-> prev_class = effective_class = brk_class (*p);
# 193| cur_pos = 0;
# 194|
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:195:11: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 193| cur_pos = 0;
# 194|
# 195|-> env = brk_env_new (brk ? brk : brk_get_shared_brk ());
# 196|
# 197| while (*++p && cur_pos < pos_sz) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:201:21: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 199| brk_op_t op;
# 200|
# 201|-> new_class = brk_class (*p);
# 202|
# 203| if (BRK_CLASS_THAI == prev_class || BRK_CLASS_ALPHA == prev_class) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:228:25: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 226| int n_brk, i;
# 227|
# 228|-> n_brk = brk_maximal_do (chunk, p - chunk,
# 229| pos + cur_pos, pos_sz - cur_pos, env);
# 230| for (i = 0; i < n_brk; i++)
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thbrk/thbrk.c:250:14: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thbrk/thbrk.c:313:1: enter_function: entry to ‘th_brk_line’
libthai-0.1.29/src/thbrk/thbrk.c:316:12: call_function: calling ‘th_brk_insert_breaks’ from ‘th_brk_line’
# 248| chunk = acronym_end = p;
# 249|
# 250|-> op = brk_op (effective_class, new_class);
# 251|
# 252| switch (op) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwbrk/thwbrk.c:64:5: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thwbrk/thwbrk.c:91:1: enter_function: entry to ‘th_brk_wc_insert_breaks’
libthai-0.1.29/src/thwbrk/thwbrk.c:101:8: branch_false: following ‘false’ branch (when ‘n_brk_pos <= 4611686018427387903’)...
libthai-0.1.29/src/thwbrk/thwbrk.c:103:31: branch_false: ...to here
libthai-0.1.29/src/thwbrk/thwbrk.c:103:23: acquire_memory: allocated here
libthai-0.1.29/src/thwbrk/thwbrk.c:104:8: branch_false: following ‘false’ branch (when ‘brk_pos’ is non-NULL)...
libthai-0.1.29/src/thwbrk/thwbrk.c:107:17: branch_false: ...to here
libthai-0.1.29/src/thwbrk/thwbrk.c:107:17: call_function: calling ‘th_brk_wc_find_breaks’ from ‘th_brk_wc_insert_breaks’
# 62| if (!tis_str)
# 63| return 0;
# 64|-> th_uni2tis_line (s, tis_str, alloc_size);
# 65|
# 66| /* do word break */
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwbrk/thwbrk.c:64:5: warning[-Wanalyzer-malloc-leak]: leak of ‘tis_str’
libthai-0.1.29/src/thwbrk/thwbrk.c:149:1: enter_function: entry to ‘th_wbrk’
libthai-0.1.29/src/thwbrk/thwbrk.c:151:12: call_function: calling ‘th_brk_wc_find_breaks’ from ‘th_wbrk’
# 62| if (!tis_str)
# 63| return 0;
# 64|-> th_uni2tis_line (s, tis_str, alloc_size);
# 65|
# 66| /* do word break */
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwbrk/thwbrk.c:67:11: warning[-Wanalyzer-malloc-leak]: leak of ‘brk_pos’
libthai-0.1.29/src/thwbrk/thwbrk.c:91:1: enter_function: entry to ‘th_brk_wc_insert_breaks’
libthai-0.1.29/src/thwbrk/thwbrk.c:101:8: branch_false: following ‘false’ branch (when ‘n_brk_pos <= 4611686018427387903’)...
libthai-0.1.29/src/thwbrk/thwbrk.c:103:31: branch_false: ...to here
libthai-0.1.29/src/thwbrk/thwbrk.c:103:23: acquire_memory: allocated here
libthai-0.1.29/src/thwbrk/thwbrk.c:104:8: branch_false: following ‘false’ branch (when ‘brk_pos’ is non-NULL)...
libthai-0.1.29/src/thwbrk/thwbrk.c:107:17: branch_false: ...to here
libthai-0.1.29/src/thwbrk/thwbrk.c:107:17: call_function: calling ‘th_brk_wc_find_breaks’ from ‘th_brk_wc_insert_breaks’
# 65|
# 66| /* do word break */
# 67|-> ret = th_brk_find_breaks (brk, tis_str, pos, pos_sz);
# 68|
# 69| free (tis_str);
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:39:9: warning[-Wanalyzer-malloc-leak]: leak of ‘norm8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:77:35: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 37| return 0;
# 38|
# 39|-> if (th_uni2tis (*wsrc) == THCHAR_ERR) {
# 40| /* skip THCHAR_ERR chunk */
# 41| int len = 0;
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:39:9: warning[-Wanalyzer-malloc-leak]: leak of ‘src8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 37| return 0;
# 38|
# 39|-> if (th_uni2tis (*wsrc) == THCHAR_ERR) {
# 40| /* skip THCHAR_ERR chunk */
# 41| int len = 0;
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:42:25: warning[-Wanalyzer-malloc-leak]: leak of ‘norm8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:77:35: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 40| /* skip THCHAR_ERR chunk */
# 41| int len = 0;
# 42|-> while (*wsrc && th_uni2tis (*wsrc) == THCHAR_ERR) {
# 43| ++wsrc; ++len;
# 44| }
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:42:25: warning[-Wanalyzer-malloc-leak]: leak of ‘src8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 40| /* skip THCHAR_ERR chunk */
# 41| int len = 0;
# 42|-> while (*wsrc && th_uni2tis (*wsrc) == THCHAR_ERR) {
# 43| ++wsrc; ++len;
# 44| }
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:51:42: warning[-Wanalyzer-malloc-leak]: leak of ‘norm8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:77:35: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 49|
# 50| /* convert Thai chunk */
# 51|-> while (left > 1 && *wsrc && (c = th_uni2tis (*wsrc)) != THCHAR_ERR) {
# 52| *dest++ = c; ++wsrc; --left;
# 53| }
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:51:42: warning[-Wanalyzer-malloc-leak]: leak of ‘src8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 49|
# 50| /* convert Thai chunk */
# 51|-> while (left > 1 && *wsrc && (c = th_uni2tis (*wsrc)) != THCHAR_ERR) {
# 52| *dest++ = c; ++wsrc; --left;
# 53| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libthai-0.1.29/src/thwstr/thwstr.c:52:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dest’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: this call could return NULL
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 50| /* convert Thai chunk */
# 51| while (left > 1 && *wsrc && (c = th_uni2tis (*wsrc)) != THCHAR_ERR) {
# 52|-> *dest++ = c; ++wsrc; --left;
# 53| }
# 54| *dest = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libthai-0.1.29/src/thwstr/thwstr.c:54:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dest’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: this call could return NULL
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
# 52| *dest++ = c; ++wsrc; --left;
# 53| }
# 54|-> *dest = 0;
# 55| return n - left; /* always non-negative, null-terminator excluded */
# 56| }
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:84:28: warning[-Wanalyzer-malloc-leak]: leak of ‘norm8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:77:35: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:80:25: return_function: returning to ‘th_wnormalize’ from ‘th_wthaichunk’
libthai-0.1.29/src/thwstr/thwstr.c:82:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:84:28: branch_true: ...to here
libthai-0.1.29/src/thwstr/thwstr.c:84:28: throw: if ‘th_normalize’ throws an exception...
libthai-0.1.29/src/thwstr/thwstr.c:84:28: danger: ‘norm8’ leaks here; was allocated at [(2)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/1)
# 82| if (chunk_len > 0) {
# 83| int i;
# 84|-> int norm_len = th_normalize (norm8, src8, n);
# 85| for (i = 0; left > 1 && i < norm_len; ++i) {
# 86| *wdest++ = th_tis2uni (norm8[i]); --left;
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:84:28: warning[-Wanalyzer-malloc-leak]: leak of ‘src8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:80:25: return_function: returning to ‘th_wnormalize’ from ‘th_wthaichunk’
libthai-0.1.29/src/thwstr/thwstr.c:82:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:84:28: branch_true: ...to here
libthai-0.1.29/src/thwstr/thwstr.c:84:28: throw: if ‘th_normalize’ throws an exception...
libthai-0.1.29/src/thwstr/thwstr.c:84:28: danger: ‘src8’ leaks here; was allocated at [(2)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/1)
# 82| if (chunk_len > 0) {
# 83| int i;
# 84|-> int norm_len = th_normalize (norm8, src8, n);
# 85| for (i = 0; left > 1 && i < norm_len; ++i) {
# 86| *wdest++ = th_tis2uni (norm8[i]); --left;
Error: GCC_ANALYZER_WARNING (CWE-401):
libthai-0.1.29/src/thwstr/thwstr.c:86:28: warning[-Wanalyzer-malloc-leak]: leak of ‘src8’
libthai-0.1.29/src/thwstr/thwstr.c:73:1: enter_function: entry to ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:76:34: acquire_memory: allocated here
libthai-0.1.29/src/thwstr/thwstr.c:79:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:80:25: call_function: calling ‘th_wthaichunk’ from ‘th_wnormalize’
libthai-0.1.29/src/thwstr/thwstr.c:80:25: return_function: returning to ‘th_wnormalize’ from ‘th_wthaichunk’
libthai-0.1.29/src/thwstr/thwstr.c:82:12: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:84:28: branch_true: ...to here
libthai-0.1.29/src/thwstr/thwstr.c:85:25: branch_true: following ‘true’ branch...
libthai-0.1.29/src/thwstr/thwstr.c:86:45: branch_true: ...to here
libthai-0.1.29/src/thwstr/thwstr.c:86:28: throw: if ‘th_tis2uni’ throws an exception...
libthai-0.1.29/src/thwstr/thwstr.c:86:28: danger: ‘src8’ leaks here; was allocated at [(2)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/1)
# 84| int norm_len = th_normalize (norm8, src8, n);
# 85| for (i = 0; left > 1 && i < norm_len; ++i) {
# 86|-> *wdest++ = th_tis2uni (norm8[i]); --left;
# 87| }
# 88| } else {