libhangul / libhangul

A library to support hangul input method logic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some issues reported by Coverity Scan

epico opened this issue · comments

Here are some reports from Coverity Scan for libhangul-0.1.0.

1. Defect type: GCC_ANALYZER_WARNING
1. libhangul-0.1.0/hangul/hanja.c:0: scope_hint: In function 'hanja_table_match'
2. libhangul-0.1.0/hangul/hanja.c:435:32: warning[-Wanalyzer-malloc-leak]: leak of 'hanja'
#   433|   		char* comment = strtok_r(NULL, "\r\n", &save);
#   434|   
#   435|-> 		Hanja* hanja = hanja_new(p, value, comment);
#   436|   
#   437|   		if (*list == NULL) {
2. Defect type: GCC_ANALYZER_WARNING
1. libhangul-0.1.0/hangul/hanja.c:0: scope_hint: In function 'hanja_list_append_n'
2. libhangul-0.1.0/hangul/hanja.c:389:19: warning[-Wanalyzer-null-dereference]: dereference of NULL 'list'
#   387|   	for (i = 0; i < n ; i++)
#   388|   	    list->items[list->len + i] = hanja + i;
#   389|-> 	list->len += n;
#   390|       }
#   391|   }
3. Defect type: GCC_ANALYZER_WARNING
1. libhangul-0.1.0/hangul/hanja.c:0: scope_hint: In function 'hanja_list_reserve'
2. libhangul-0.1.0/hangul/hanja.c:358:12: warning[-Wanalyzer-null-dereference]: dereference of NULL 'list'
#   356|   hanja_list_reserve(HanjaList* list, size_t n)
#   357|   {
#   358|->     size_t size = list->alloc;
#   359|   
#   360|       if (n > SIZE_MAX / sizeof(list->items[0]) - list->len)

Does the above defect mean some issue or just false alert?