Task #132003 - libcomps-0.1.24-1.fc44/scan-results.err
back to task #132003download
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:173:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_bradix.c:152:8: branch_false: following ‘false’ branch (when ‘brt’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:154:16: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:169:59: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:173:9: danger: dereference of NULL ‘comps_brtree_data_create(brt, *(COMPS_BRTreeData *)it_34->data.key, 0)’
# 171|
# 172| comps_hslist_destroy(&brtdata->subnodes);
# 173|-> brtdata->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 174| brtdata->data = new_data;
# 175| comps_hslist_append(ret->subnodes, brtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:175:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_bradix.c:144:16: enter_function: entry to ‘comps_brtree_clone’
libcomps-0.1.24/libcomps/src/comps_bradix.c:152:8: branch_false: following ‘false’ branch (when ‘brt’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:154:16: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:169:59: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:168:19: call_function: calling ‘comps_brtree_data_create’ from ‘comps_brtree_clone’
libcomps-0.1.24/libcomps/src/comps_bradix.c:168:19: return_function: returning to ‘comps_brtree_clone’ from ‘comps_brtree_data_create’
libcomps-0.1.24/libcomps/src/comps_bradix.c:175:9: danger: dereference of NULL ‘comps_brtree_create(*brt.data_constructor, *brt.data_cloner, *brt.data_destructor, *brt.key_clone, *brt.key_destroy, *brt.key_cmp, *brt.key_len, *brt.subkey, *brt.key_concat)’
# 173| brtdata->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 174| brtdata->data = new_data;
# 175|-> comps_hslist_append(ret->subnodes, brtdata, 0);
# 176|
# 177| comps_hslist_append(to_clone, brtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_bradix.c:182:39: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*to_clone.first’
libcomps-0.1.24/libcomps/src/comps_bradix.c:152:8: branch_false: following ‘false’ branch (when ‘brt’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:154:16: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:180:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:182:39: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:187:35: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:201:29: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:202:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_bradix.c:180:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:182:39: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:182:39: danger: use after ‘free’ of ‘*to_clone.first’; freed at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
# 180| while (to_clone->first) {
# 181| it2 = to_clone->first;
# 182|-> tmplist = ((COMPS_BRTreeData*)it2->data)->subnodes;
# 183| comps_hslist_remove(to_clone, to_clone->first);
# 184|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:195:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_bradix.c:152:8: branch_false: following ‘false’ branch (when ‘brt’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:154:16: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:167:37: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:180:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:182:39: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:190:16: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:194:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:195:13: danger: dereference of NULL ‘comps_brtree_data_create(brt, *(COMPS_BRTreeData *)it_35->data.key, 0)’
# 193| new_data = NULL;
# 194| comps_hslist_destroy(&brtdata->subnodes);
# 195|-> brtdata->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 196| brtdata->data = new_data;
# 197| comps_hslist_append(new_subnodes, brtdata, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:517: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 515|
# 516| pair = malloc(sizeof(struct Pair));
# 517|-> pair->subnodes = brt->subnodes;
# 518| pair->key = NULL;
# 519| pair->added = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:517:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_bradix.c:516:12: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_bradix.c:517:5: danger: ‘pair’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
# 515|
# 516| pair = malloc(sizeof(struct Pair));
# 517|-> pair->subnodes = brt->subnodes;
# 518| pair->key = NULL;
# 519| pair->added = 0;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:518: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 516| pair = malloc(sizeof(struct Pair));
# 517| pair->subnodes = brt->subnodes;
# 518|-> pair->key = NULL;
# 519| pair->added = 0;
# 520|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:519: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 517| pair->subnodes = brt->subnodes;
# 518| pair->key = NULL;
# 519|-> pair->added = 0;
# 520|
# 521| tmplist = comps_hslist_create();
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_bradix.c:534:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘**tmplist.first.data’
libcomps-0.1.24/libcomps/src/comps_bradix.c:531:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:533:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:538:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:577:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:581:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_bradix.c:531:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:533:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:534:9: danger: use after ‘free’ of ‘*tmplist.73_35->first.data’; freed at [(6)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/5)
# 532| it = tmplist->first;
# 533| comps_hslist_remove(tmplist, tmplist->first);
# 534|-> tmp_subnodes = ((struct Pair*)it->data)->subnodes;
# 535| parent_pair = (struct Pair*) it->data;
# 536| free(it);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:540: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 538| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 539| pair = malloc(sizeof(struct Pair));
# 540|-> pair->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 541| pair->added = 0;
# 542|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:540:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_bradix.c:531:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:533:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:538:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:539:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:539:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_bradix.c:540:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/4)
# 538| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 539| pair = malloc(sizeof(struct Pair));
# 540|-> pair->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 541| pair->added = 0;
# 542|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:541: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 539| pair = malloc(sizeof(struct Pair));
# 540| pair->subnodes = ((COMPS_BRTreeData*)it->data)->subnodes;
# 541|-> pair->added = 0;
# 542|
# 543| if (parent_pair->key != NULL) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:556: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 554| } else {
# 555| rtpair = malloc(sizeof(COMPS_BRTreePair));
# 556|-> rtpair->key = pair->key;
# 557| rtpair->data = ((COMPS_BRTreeData*)it->data)->data;
# 558| rtpair->key_destroy = brt->key_destroy;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:556:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rtpair’
libcomps-0.1.24/libcomps/src/comps_bradix.c:531:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:533:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:538:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:539:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:543:16: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:544:29: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:551:16: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_bradix.c:552:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:552:20: branch_false: following ‘false’ branch (when ‘pairorkey != 1’)...
libcomps-0.1.24/libcomps/src/comps_bradix.c:555:30: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_bradix.c:555:30: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_bradix.c:556:21: danger: ‘rtpair’ could be NULL: unchecked value from [(11)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/10)
# 554| } else {
# 555| rtpair = malloc(sizeof(COMPS_BRTreePair));
# 556|-> rtpair->key = pair->key;
# 557| rtpair->data = ((COMPS_BRTreeData*)it->data)->data;
# 558| rtpair->key_destroy = brt->key_destroy;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:557: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 555| rtpair = malloc(sizeof(COMPS_BRTreePair));
# 556| rtpair->key = pair->key;
# 557|-> rtpair->data = ((COMPS_BRTreeData*)it->data)->data;
# 558| rtpair->key_destroy = brt->key_destroy;
# 559| comps_hslist_append(ret, rtpair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_bradix.c:558: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 556| rtpair->key = pair->key;
# 557| rtpair->data = ((COMPS_BRTreeData*)it->data)->data;
# 558|-> rtpair->key_destroy = brt->key_destroy;
# 559| comps_hslist_append(ret, rtpair, 0);
# 560| }
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c: scope_hint: In function ‘comps2xml_f’
libcomps-0.1.24/libcomps/src/comps_doc.c:215:5: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 215 | xmlMemoryDump();
# | ^~~~~~~~~~~~~
/usr/include/libxml2/libxml/tree.h:28: included_from: Included from here.
/usr/include/libxml2/libxml/xmlIO.h:18: included_from: Included from here.
/usr/include/libxml2/libxml/xmlwriter.h:18: included_from: Included from here.
libcomps-0.1.24/libcomps/src/comps_utils.h:32: included_from: Included from here.
libcomps-0.1.24/libcomps/src/comps_objradix.h:28: included_from: Included from here.
libcomps-0.1.24/libcomps/src/comps_objdict.h:32: included_from: Included from here.
libcomps-0.1.24/libcomps/src/comps_doc.h:24: included_from: Included from here.
libcomps-0.1.24/libcomps/src/comps_doc.c:20: included_from: Included from here.
/usr/include/libxml2/libxml/xmlmemory.h:161:9: note: declared here
# 161 | xmlMemoryDump (void);
# | ^~~~~~~~~~~~~
# 213| xmlFreeDoc(xmldoc);
# 214| xmlCleanupParser();
# 215|-> xmlMemoryDump();
# 216| return genret;
# 217| }
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c:215:5: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 213| xmlFreeDoc(xmldoc);
# 214| xmlCleanupParser();
# 215|-> xmlMemoryDump();
# 216| return genret;
# 217| }
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c: scope_hint: In function ‘comps2xml_str’
libcomps-0.1.24/libcomps/src/comps_doc.c:261:9: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 261 | xmlMemoryDump();
# | ^~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlmemory.h:161:9: note: declared here
# 161 | xmlMemoryDump (void);
# | ^~~~~~~~~~~~~
# 259| xmlBufferFree(xmlbuff);
# 260| xmlCleanupParser();
# 261|-> xmlMemoryDump();
# 262| return NULL;
# 263| } else {
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c:261:9: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 259| xmlBufferFree(xmlbuff);
# 260| xmlCleanupParser();
# 261|-> xmlMemoryDump();
# 262| return NULL;
# 263| } else {
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c:269:5: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 269 | xmlMemoryDump();
# | ^~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlmemory.h:161:9: note: declared here
# 161 | xmlMemoryDump (void);
# | ^~~~~~~~~~~~~
# 267|
# 268| xmlCleanupParser();
# 269|-> xmlMemoryDump();
# 270| return ret;
# 271| }
Error: COMPILER_WARNING (CWE-477):
libcomps-0.1.24/libcomps/src/comps_doc.c:269:5: warning[-Wdeprecated-declarations]: ‘xmlMemoryDump’ is deprecated
# 267|
# 268| xmlCleanupParser();
# 269|-> xmlMemoryDump();
# 270| return ret;
# 271| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_doc.c:903:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘str’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_doc.c:894:10: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_doc.c:896:18: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_doc.c:897:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_doc.c:898:17: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_doc.c:898:16: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_doc.c:900:26: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_doc.c:902:19: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_doc.c:903:13: danger: argument 1 (‘str’) from [(7)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 901| }
# 902| str = malloc(digits_count(x)*(sizeof(char)+2));
# 903|-> sprintf(str, "%zu.", x);
# 904| comps_valgenres_prefix(tmpres, str);
# 905| free(str);
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_docgroupid.c:97:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_docgroupid.c:96:17: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_docgroupid.c:97:5: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 95| char *def = ((COMPS_DocGroupId*)docgroupid)->def?"True":"False";
# 96| char *ret = malloc(sizeof(char)*(len+strlen(name)+strlen(def)+1));
# 97|-> sprintf(ret, "<COMPS_DocGroupId name='%s' default='%s'>", name, def);
# 98| free(name);
# 99| return ret;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_docpackage.c:220: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 218| char *ret = malloc(sizeof(char)*(total_len));
# 219|
# 220|-> snprintf(ret, total_len, "<COMPS_DocGroupPackage name='%s' type='%s'"
# 221| " requires='%s' basearchonly='%s'>",
# 222| name, type, requires, basearchonly);
Error: COMPILER_WARNING:
libcomps-0.1.24/libcomps/src/comps_hslist.c: scope_hint: In function ‘comps_hslist_destroy’
libcomps-0.1.24/libcomps/src/comps_hslist.c:187:18: warning[-Wunused-but-set-variable=]: variable ‘x’ set but not used
# 187 | unsigned int x;
# | ^
# 185| void comps_hslist_destroy(COMPS_HSList ** hslist) {
# 186| COMPS_HSListItem *it,*oldit;
# 187|-> unsigned int x;
# 188| if (*hslist == NULL) return;
# 189| oldit = (*hslist)->first;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_log.c:94:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘comps_log_entry_create()’
libcomps-0.1.24/libcomps/src/comps_log.c:157:6: enter_function: entry to ‘comps_log_warning_x’
libcomps-0.1.24/libcomps/src/comps_log.c:160:5: call_function: calling ‘__comps_log_entry_x’ from ‘comps_log_warning_x’
# 92| entry = comps_log_entry_create();
# 93|
# 94|-> entry->args = malloc(sizeof(COMPS_Object*) * n);
# 95| entry->arg_count = n;
# 96| entry->code = code;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_log.c:128:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*<unknown>.args + (long unsigned int)i * 8’
libcomps-0.1.24/libcomps/src/comps_log.c:157:6: enter_function: entry to ‘comps_log_warning_x’
libcomps-0.1.24/libcomps/src/comps_log.c:160:5: call_function: calling ‘__comps_log_entry_x’ from ‘comps_log_warning_x’
# 126| for (int i=0; i<n; i++) {
# 127| val = va_arg(va, COMPS_Object*);
# 128|-> entry->args[i] = val;
# 129| }
# 130| if (log->std_out) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_log.c:171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: args
# 169|
# 170| for (int i = 0; i < log_entry->arg_count; i++) {
# 171|-> args[i] = comps_object_tostr((COMPS_Object*)log_entry->args[i]);
# 172| *total_len += strlen(args[i]);
# 173| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_log.c:171:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘args’
libcomps-0.1.24/libcomps/src/comps_log.c:167:12: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_log.c:170:21: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_log.c:171:53: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_log.c:171:9: danger: ‘args + (long unsigned int)i * 8’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
# 169|
# 170| for (int i = 0; i < log_entry->arg_count; i++) {
# 171|-> args[i] = comps_object_tostr((COMPS_Object*)log_entry->args[i]);
# 172| *total_len += strlen(args[i]);
# 173| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_log.c:172: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: args
# 170| for (int i = 0; i < log_entry->arg_count; i++) {
# 171| args[i] = comps_object_tostr((COMPS_Object*)log_entry->args[i]);
# 172|-> *total_len += strlen(args[i]);
# 173| }
# 174| return args;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:183: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 181|
# 182| pair = malloc(sizeof(struct Pair));
# 183|-> pair->subnodes = rt2->subnodes;
# 184| pair->key = NULL;
# 185|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:184: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 182| pair = malloc(sizeof(struct Pair));
# 183| pair->subnodes = rt2->subnodes;
# 184|-> pair->key = NULL;
# 185|
# 186| tmplist = comps_hslist_create();
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:199: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 197| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 198| pair = malloc(sizeof(struct Pair));
# 199|-> pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
# 200|
# 201| if (parent_pair->key != NULL) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:257: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 255|
# 256| pair = malloc(sizeof(struct Pair));
# 257|-> pair->subnodes = rt->subnodes;
# 258| pair->key = NULL;
# 259| pair->added = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:257:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_mradix.c:256:12: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_mradix.c:257:5: danger: ‘pair’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 255|
# 256| pair = malloc(sizeof(struct Pair));
# 257|-> pair->subnodes = rt->subnodes;
# 258| pair->key = NULL;
# 259| pair->added = 0;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:258: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 256| pair = malloc(sizeof(struct Pair));
# 257| pair->subnodes = rt->subnodes;
# 258|-> pair->key = NULL;
# 259| pair->added = 0;
# 260|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:259: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 257| pair->subnodes = rt->subnodes;
# 258| pair->key = NULL;
# 259|-> pair->added = 0;
# 260|
# 261| tmplist = comps_hslist_create();
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_mradix.c:270:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘**tmplist.first.data’
libcomps-0.1.24/libcomps/src/comps_mradix.c:267:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:269:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:274:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:18: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:319:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_mradix.c:267:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:269:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:270:9: danger: use after ‘free’ of ‘*tmplist.29_46->first.data’; freed at [(8)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/7)
# 268| it = tmplist->first;
# 269| comps_hslist_remove(tmplist, tmplist->first);
# 270|-> tmp_subnodes = ((struct Pair*)it->data)->subnodes;
# 271| parent_pair = (struct Pair*) it->data;
# 272| free(it);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:276: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 274| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 275| pair = malloc(sizeof(struct Pair));
# 276|-> pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
# 277| pair->added = 0;
# 278|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_mradix.c:277: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 275| pair = malloc(sizeof(struct Pair));
# 276| pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
# 277|-> pair->added = 0;
# 278|
# 279| if (parent_pair->key != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:13: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)**tmplist.first.data).key’
libcomps-0.1.24/libcomps/src/comps_mradix.c:267:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:269:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:274:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:18: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:13: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_mradix.c:267:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:269:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:274:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:317:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:18: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_mradix.c:318:13: danger: second ‘free’ here; first ‘free’ was at [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
# 316| }
# 317| if (parent_pair->added == 0)
# 318|-> free(parent_pair->key);
# 319| free(parent_pair);
# 320| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:10: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: obj
# 8| COMPS_Object *obj;
# 9| obj = malloc(obj_info->obj_size);
# 10|-> obj->obj_info = obj_info;
# 11| obj->refc = comps_refc_create((void*)obj,
# 12| (void (*)(void*)) obj_info->destructor);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:10:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘obj’
libcomps-0.1.24/libcomps/src/comps_obj.c:9:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:10:5: danger: ‘obj’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 8| COMPS_Object *obj;
# 9| obj = malloc(obj_info->obj_size);
# 10|-> obj->obj_info = obj_info;
# 11| obj->refc = comps_refc_create((void*)obj,
# 12| (void (*)(void*)) obj_info->destructor);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:11: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: obj
# 9| obj = malloc(obj_info->obj_size);
# 10| obj->obj_info = obj_info;
# 11|-> obj->refc = comps_refc_create((void*)obj,
# 12| (void (*)(void*)) obj_info->destructor);
# 13| if (obj_info->constructor)
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:36: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: obj
# 34| COMPS_Object *obj;
# 35| obj = malloc(comps_obj->obj_info->obj_size);
# 36|-> obj->refc = comps_refc_create((void*)obj,
# 37| (void (*)(void*)) comps_obj->obj_info->destructor);
# 38| obj->obj_info = comps_obj->obj_info;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:38: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: obj
# 36| obj->refc = comps_refc_create((void*)obj,
# 37| (void (*)(void*)) comps_obj->obj_info->destructor);
# 38|-> obj->obj_info = comps_obj->obj_info;
# 39| comps_obj->obj_info->copy(obj, comps_obj);
# 40| return obj;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:69: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 67| } else {
# 68| ret = malloc(sizeof(char));
# 69|-> ret[0]=0;
# 70| return ret;;
# 71| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:69:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/src/comps_obj.c:68:15: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:69:9: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 67| } else {
# 68| ret = malloc(sizeof(char));
# 69|-> ret[0]=0;
# 70| return ret;;
# 71| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:105:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:104:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:105:5: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 103| x = (int)(log10(((COMPS_Num*)num)->val)) + 1;
# 104| ret = malloc(sizeof(char)*(x+1));
# 105|-> sprintf(ret, "%d", ((COMPS_Num*)num)->val);
# 106| return ret;
# 107| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:117:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_Str *)*args_10(D).val) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:114:8: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_obj.c:115:34: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:117:9: danger: argument 1 (‘malloc(strlen(*(COMPS_Str *)*args_10(D).val) + 1)’) from [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 115| ((COMPS_Str*)str)->val = malloc(sizeof(char) *
# 116| (strlen(((COMPS_Str*)args[0])->val)+1));
# 117|-> strcpy(((COMPS_Str*)str)->val, ((COMPS_Str*)args[0])->val);
# 118| }
# 119| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:126:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_Str *)str_src.val) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:122:8: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_obj.c:125:31: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_obj.c:124:23: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:126:9: danger: argument 1 (‘malloc(strlen(*(COMPS_Str *)str_src.val) + 1)’) from [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 124| malloc(sizeof(char) *
# 125| (strlen(((COMPS_Str*)str_src)->val) + 1));
# 126|-> strcpy(((COMPS_Str*)str_dst)->val, ((COMPS_Str*)str_src)->val);
# 127| } else
# 128| ((COMPS_Str*)str_dst)->val = NULL;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:139: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 137| if (((COMPS_Str*)str)->val) {
# 138| ret = malloc(sizeof(char)*(strlen(((COMPS_Str*)str)->val)+1));
# 139|-> strcpy(ret, ((COMPS_Str*)str)->val);
# 140| } else {
# 141| ret = malloc(sizeof(char));
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:139:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:137:8: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_obj.c:138:36: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_obj.c:138:15: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:139:9: danger: argument 1 (‘ret’) from [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 137| if (((COMPS_Str*)str)->val) {
# 138| ret = malloc(sizeof(char)*(strlen(((COMPS_Str*)str)->val)+1));
# 139|-> strcpy(ret, ((COMPS_Str*)str)->val);
# 140| } else {
# 141| ret = malloc(sizeof(char));
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:142: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 140| } else {
# 141| ret = malloc(sizeof(char));
# 142|-> ret[0] = 0;
# 143| }
# 144| return ret;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_obj.c:142:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/src/comps_obj.c:141:15: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:142:9: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
# 140| } else {
# 141| ret = malloc(sizeof(char));
# 142|-> ret[0] = 0;
# 143| }
# 144| return ret;
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:167:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(s) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:165:8: branch_true: following ‘true’ branch (when ‘s’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_obj.c:166:44: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_obj.c:166:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:167:9: danger: argument 1 (‘malloc(strlen(s) + 1)’) from [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
# 165| if (s) {
# 166| ret->val = malloc(sizeof(char) * ((strlen(s)+1)));
# 167|-> strcpy(ret->val, s);
# 168| } else
# 169| ret->val = NULL;
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_obj.c:180:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*str.val’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_obj.c:179:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_obj.c:180:5: danger: argument 1 (‘malloc(strlen(s) + 1)’) from [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 178| free(str->val);
# 179| str->val = malloc(sizeof(char) * ((strlen(s)+1)));
# 180|-> strcpy(str->val, s);
# 181| }
# 182| signed char comps_str_fnmatch(COMPS_Str *str, char *pattern, int flags) {
Error: GCC_ANALYZER_WARNING (CWE-401):
libcomps-0.1.24/libcomps/src/comps_objlist.c:144:9: warning[-Wanalyzer-malloc-leak]: leak of ‘comps_objlist_it_create(obj)’
libcomps-0.1.24/libcomps/src/comps_objlist.c:409:6: enter_function: entry to ‘comps_objlist_concat_in’
libcomps-0.1.24/libcomps/src/comps_objlist.c:411:29: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objlist.c:412:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:412:9: call_function: calling ‘comps_objlist_append’ from ‘comps_objlist_concat_in’
# 142|
# 143| static int __comps_objlist_append(COMPS_ObjList *objlist, COMPS_ObjListIt *objit) {
# 144|-> if (!objlist || !objit) return 0;
# 145| if (objlist->first == NULL) {
# 146| objlist->first = objit;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:211:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘newit’
libcomps-0.1.24/libcomps/src/comps_objlist.c:241:5: enter_function: entry to ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:244:8: branch_false: following ‘false’ branch (when ‘objlist’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:9: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: call_function: calling ‘comps_objlist_it_create’ from ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: return_function: returning to ‘comps_objlist_insert_at’ from ‘comps_objlist_it_create’
libcomps-0.1.24/libcomps/src/comps_objlist.c:247:12: call_function: calling ‘__comps_objlist_insert_at’ from ‘comps_objlist_insert_at’
# 209| unsigned int i;
# 210| if (pos == 0) {
# 211|-> newit->next = objlist->first;
# 212| objlist->first = newit;
# 213| if (!objlist->last) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:217:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘newit’
libcomps-0.1.24/libcomps/src/comps_objlist.c:241:5: enter_function: entry to ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:244:8: branch_false: following ‘false’ branch (when ‘objlist’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:9: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: call_function: calling ‘comps_objlist_it_create’ from ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: return_function: returning to ‘comps_objlist_insert_at’ from ‘comps_objlist_it_create’
libcomps-0.1.24/libcomps/src/comps_objlist.c:247:12: call_function: calling ‘__comps_objlist_insert_at’ from ‘comps_objlist_insert_at’
# 215| }
# 216| } else if (pos == objlist->len){
# 217|-> newit->next = NULL;
# 218| objlist->last->next = newit;
# 219| objlist->last = newit;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:227: warning[nullPointer]: Possible null pointer dereference: oldit
# 225| oldit = tmpit;
# 226| }
# 227|-> newit->next = oldit->next;
# 228| oldit->next = newit;
# 229| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:227:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘newit’
libcomps-0.1.24/libcomps/src/comps_objlist.c:241:5: enter_function: entry to ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:244:8: branch_false: following ‘false’ branch (when ‘objlist’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:9: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: call_function: calling ‘comps_objlist_it_create’ from ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: return_function: returning to ‘comps_objlist_insert_at’ from ‘comps_objlist_it_create’
libcomps-0.1.24/libcomps/src/comps_objlist.c:247:12: call_function: calling ‘__comps_objlist_insert_at’ from ‘comps_objlist_insert_at’
# 225| oldit = tmpit;
# 226| }
# 227|-> newit->next = oldit->next;
# 228| oldit->next = newit;
# 229| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:227:23: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘oldit’
libcomps-0.1.24/libcomps/src/comps_objlist.c:241:5: enter_function: entry to ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:244:8: branch_false: following ‘false’ branch (when ‘objlist’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:9: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:245:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: call_function: calling ‘comps_objlist_it_create’ from ‘comps_objlist_insert_at’
libcomps-0.1.24/libcomps/src/comps_objlist.c:246:30: return_function: returning to ‘comps_objlist_insert_at’ from ‘comps_objlist_it_create’
libcomps-0.1.24/libcomps/src/comps_objlist.c:247:12: call_function: calling ‘__comps_objlist_insert_at’ from ‘comps_objlist_insert_at’
# 225| oldit = tmpit;
# 226| }
# 227|-> newit->next = oldit->next;
# 228| oldit->next = newit;
# 229| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:228: warning[nullPointer]: Possible null pointer dereference: oldit
# 226| }
# 227| newit->next = oldit->next;
# 228|-> oldit->next = newit;
# 229| }
# 230| objlist->len++;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:469: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 467| //total2=0;
# 468| ret = malloc(sizeof(char) * (total_strlen));
# 469|-> ret[0]=0;
# 470| strcat(ret, "[");
# 471| //total2 += strlen("[");
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:469:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/src/comps_objlist.c:468:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objlist.c:469:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
# 467| //total2=0;
# 468| ret = malloc(sizeof(char) * (total_strlen));
# 469|-> ret[0]=0;
# 470| strcat(ret, "[");
# 471| //total2 += strlen("[");
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objlist.c:470: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 468| ret = malloc(sizeof(char) * (total_strlen));
# 469| ret[0]=0;
# 470|-> strcat(ret, "[");
# 471| //total2 += strlen("[");
# 472| if (((COMPS_ObjList*)list)->len) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:291: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 289|
# 290| pair = malloc(sizeof(struct Pair));
# 291|-> pair->subnodes = rt2->subnodes;
# 292| pair->key = NULL;
# 293|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:292: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 290| pair = malloc(sizeof(struct Pair));
# 291| pair->subnodes = rt2->subnodes;
# 292|-> pair->key = NULL;
# 293|
# 294| tmplist = comps_hslist_create();
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:307: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 305| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 306| pair = malloc(sizeof(struct Pair));
# 307|-> pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;
# 308|
# 309| if (parent_pair->key != NULL) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:632: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 630| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 631| pair = malloc(sizeof(struct Pair));
# 632|-> pair->key = __comps_strcpy(((COMPS_ObjMRTreeData*)hsit->data)->key);
# 633| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 634| pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:632:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:630:38: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:631:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:631:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objmradix.c:632:9: danger: ‘pair’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 630| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 631| pair = malloc(sizeof(struct Pair));
# 632|-> pair->key = __comps_strcpy(((COMPS_ObjMRTreeData*)hsit->data)->key);
# 633| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 634| pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:633: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 631| pair = malloc(sizeof(struct Pair));
# 632| pair->key = __comps_strcpy(((COMPS_ObjMRTreeData*)hsit->data)->key);
# 633|-> pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 634| pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
# 635| comps_hslist_append(to_process, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:634: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 632| pair->key = __comps_strcpy(((COMPS_ObjMRTreeData*)hsit->data)->key);
# 633| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 634|-> pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
# 635| comps_hslist_append(to_process, pair, 0);
# 636| }
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*to_process.first’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:654:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:655:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:665:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: danger: use after ‘free’ of ‘*to_process.first’; freed at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
# 637| while (to_process->first) {
# 638| //oldpair = current_pair;
# 639|-> current_pair = to_process->first->data;
# 640| oldit = to_process->first;
# 641| comps_hslist_remove(to_process, to_process->first);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:13: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘current_pair’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:654:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:655:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:664:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:13: danger: use after ‘free’ of ‘current_pair’; freed at [(8)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/7)
# 640| oldit = to_process->first;
# 641| comps_hslist_remove(to_process, to_process->first);
# 642|-> if (current_pair->data) {
# 643| if (keyvalpair == 0) {
# 644| comps_hslist_append(ret, __comps_strcpy(current_pair->key), 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:649: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 647| } else {
# 648| rtpair = malloc(sizeof(COMPS_ObjMRTreePair));
# 649|-> rtpair->key = __comps_strcpy(current_pair->key);
# 650| rtpair->data = current_pair->data;
# 651| comps_hslist_append(ret, rtpair, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:649:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rtpair’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:643:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:643:16: branch_false: following ‘false’ branch (when ‘keyvalpair != 0’)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:645:23: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:645:23: branch_false: following ‘false’ branch (when ‘keyvalpair != 1’)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:648:26: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:648:26: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objmradix.c:649:17: danger: ‘rtpair’ could be NULL: unchecked value from [(9)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/8)
# 647| } else {
# 648| rtpair = malloc(sizeof(COMPS_ObjMRTreePair));
# 649|-> rtpair->key = __comps_strcpy(current_pair->key);
# 650| rtpair->data = current_pair->data;
# 651| comps_hslist_append(ret, rtpair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:650: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 648| rtpair = malloc(sizeof(COMPS_ObjMRTreePair));
# 649| rtpair->key = __comps_strcpy(current_pair->key);
# 650|-> rtpair->data = current_pair->data;
# 651| comps_hslist_append(ret, rtpair, 0);
# 652| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:657: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 655| hsit != NULL; hsit = hsit->next, x++) {
# 656| pair = malloc(sizeof(struct Pair));
# 657|-> pair->key = __comps_strcat(current_pair->key,
# 658| ((COMPS_ObjMRTreeData*)hsit->data)->key);
# 659| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:657:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:655:14: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:656:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:656:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objmradix.c:657:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
# 655| hsit != NULL; hsit = hsit->next, x++) {
# 656| pair = malloc(sizeof(struct Pair));
# 657|-> pair->key = __comps_strcat(current_pair->key,
# 658| ((COMPS_ObjMRTreeData*)hsit->data)->key);
# 659| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:659: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 657| pair->key = __comps_strcat(current_pair->key,
# 658| ((COMPS_ObjMRTreeData*)hsit->data)->key);
# 659|-> pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 660| pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
# 661| comps_hslist_insert_at(to_process, x, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:660: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 658| ((COMPS_ObjMRTreeData*)hsit->data)->key);
# 659| pair->data = ((COMPS_ObjMRTreeData*)hsit->data)->data;
# 660|-> pair->subnodes = ((COMPS_ObjMRTreeData*)hsit->data)->subnodes;
# 661| comps_hslist_insert_at(to_process, x, pair, 0);
# 662| }
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)((void *)current_pair)).key’
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:654:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:655:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:9: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:637:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:639:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:642:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:654:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:655:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objmradix.c:663:9: danger: second ‘free’ here; first ‘free’ was at [(7)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/6)
# 661| comps_hslist_insert_at(to_process, x, pair, 0);
# 662| }
# 663|-> free(current_pair->key);
# 664| free(current_pair);
# 665| free(oldit);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:114:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_objradix.c:744:17: enter_function: entry to ‘comps_objrtree_union’
libcomps-0.1.24/libcomps/src/comps_objradix.c:746:11: call_function: calling ‘comps_objrtree_clone’ from ‘comps_objrtree_union’
# 112| new_data = NULL;
# 113| comps_hslist_destroy(&rtdata->subnodes);
# 114|-> rtdata->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
# 115| rtdata->data = new_data;
# 116| comps_hslist_append(ret->subnodes, rtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:135:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_objradix.c:744:17: enter_function: entry to ‘comps_objrtree_union’
libcomps-0.1.24/libcomps/src/comps_objradix.c:746:11: call_function: calling ‘comps_objrtree_clone’ from ‘comps_objrtree_union’
# 133| new_data = NULL;
# 134| comps_hslist_destroy(&rtdata->subnodes);
# 135|-> rtdata->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
# 136| rtdata->data = new_data;
# 137| comps_hslist_append(new_subnodes, rtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:353:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rt’
libcomps-0.1.24/libcomps/src/comps_objradix.c:744:17: enter_function: entry to ‘comps_objrtree_union’
libcomps-0.1.24/libcomps/src/comps_objradix.c:746:11: call_function: calling ‘comps_objrtree_clone’ from ‘comps_objrtree_union’
libcomps-0.1.24/libcomps/src/comps_objradix.c:746:11: return_function: returning to ‘comps_objrtree_union’ from ‘comps_objrtree_clone’
libcomps-0.1.24/libcomps/src/comps_objradix.c:747:5: call_function: calling ‘comps_objrtree_unite’ from ‘comps_objrtree_union’
# 351| //len = strlen(key);
# 352|
# 353|-> if (rt->subnodes == NULL)
# 354| return;
# 355|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:643: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 641| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 642| pair = malloc(sizeof(struct Pair));
# 643|-> pair->key = __comps_strcpy(((COMPS_ObjRTreeData*)hsit->data)->key);
# 644| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 645| pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:643:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:641:38: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:642:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:642:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:643:9: danger: ‘pair’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
# 641| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 642| pair = malloc(sizeof(struct Pair));
# 643|-> pair->key = __comps_strcpy(((COMPS_ObjRTreeData*)hsit->data)->key);
# 644| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 645| pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:644: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 642| pair = malloc(sizeof(struct Pair));
# 643| pair->key = __comps_strcpy(((COMPS_ObjRTreeData*)hsit->data)->key);
# 644|-> pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 645| pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
# 646| comps_hslist_append(to_process, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:645: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 643| pair->key = __comps_strcpy(((COMPS_ObjRTreeData*)hsit->data)->key);
# 644| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 645|-> pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
# 646| comps_hslist_append(to_process, pair, 0);
# 647| }
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*to_process.first’
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:665:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:666:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:676:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: danger: use after ‘free’ of ‘*to_process.first’; freed at [(7)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/6)
# 648| while (to_process->first) {
# 649| //oldpair = current_pair;
# 650|-> current_pair = to_process->first->data;
# 651| oldit = to_process->first;
# 652| comps_hslist_remove(to_process, to_process->first);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:13: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘current_pair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:665:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:666:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:675:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:13: danger: use after ‘free’ of ‘current_pair’; freed at [(8)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/7)
# 651| oldit = to_process->first;
# 652| comps_hslist_remove(to_process, to_process->first);
# 653|-> if (current_pair->data) {
# 654| if (keyvalpair == 0) {
# 655| comps_hslist_append(ret, __comps_strcpy(current_pair->key), 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:660: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 658| } else {
# 659| rtpair = malloc(sizeof(COMPS_ObjRTreePair));
# 660|-> rtpair->key = __comps_strcpy(current_pair->key);
# 661| rtpair->data = current_pair->data;
# 662| comps_hslist_append(ret, rtpair, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:660:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rtpair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:654:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:654:16: branch_false: following ‘false’ branch (when ‘keyvalpair != 0’)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:656:23: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:656:23: branch_false: following ‘false’ branch (when ‘keyvalpair != 1’)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:659:26: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:659:26: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:660:17: danger: ‘rtpair’ could be NULL: unchecked value from [(9)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/8)
# 658| } else {
# 659| rtpair = malloc(sizeof(COMPS_ObjRTreePair));
# 660|-> rtpair->key = __comps_strcpy(current_pair->key);
# 661| rtpair->data = current_pair->data;
# 662| comps_hslist_append(ret, rtpair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:661: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 659| rtpair = malloc(sizeof(COMPS_ObjRTreePair));
# 660| rtpair->key = __comps_strcpy(current_pair->key);
# 661|-> rtpair->data = current_pair->data;
# 662| comps_hslist_append(ret, rtpair, 0);
# 663| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:668: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 666| hsit != NULL; hsit = hsit->next, x++) {
# 667| pair = malloc(sizeof(struct Pair));
# 668|-> pair->key = __comps_strcat(current_pair->key,
# 669| ((COMPS_ObjRTreeData*)hsit->data)->key);
# 670| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:668:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:666:14: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:667:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:667:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:668:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/4)
# 666| hsit != NULL; hsit = hsit->next, x++) {
# 667| pair = malloc(sizeof(struct Pair));
# 668|-> pair->key = __comps_strcat(current_pair->key,
# 669| ((COMPS_ObjRTreeData*)hsit->data)->key);
# 670| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:670: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 668| pair->key = __comps_strcat(current_pair->key,
# 669| ((COMPS_ObjRTreeData*)hsit->data)->key);
# 670|-> pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 671| pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
# 672| comps_hslist_insert_at(to_process, x, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:671: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 669| ((COMPS_ObjRTreeData*)hsit->data)->key);
# 670| pair->data = ((COMPS_ObjRTreeData*)hsit->data)->data;
# 671|-> pair->subnodes = ((COMPS_ObjRTreeData*)hsit->data)->subnodes;
# 672| comps_hslist_insert_at(to_process, x, pair, 0);
# 673| }
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)((void *)current_pair)).key’
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:665:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:666:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:9: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_objradix.c:648:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:650:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:653:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:665:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:666:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:674:9: danger: second ‘free’ here; first ‘free’ was at [(7)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/6)
# 672| comps_hslist_insert_at(to_process, x, pair, 0);
# 673| }
# 674|-> free(current_pair->key);
# 675| free(current_pair);
# 676| free(oldit);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:692: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 690|
# 691| pair = malloc(sizeof(struct Pair));
# 692|-> pair->subnodes = rt2->subnodes;
# 693| pair->key = NULL;
# 694|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:692:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:691:12: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:692:5: danger: ‘pair’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
# 690|
# 691| pair = malloc(sizeof(struct Pair));
# 692|-> pair->subnodes = rt2->subnodes;
# 693| pair->key = NULL;
# 694|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:693: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 691| pair = malloc(sizeof(struct Pair));
# 692| pair->subnodes = rt2->subnodes;
# 693|-> pair->key = NULL;
# 694|
# 695| tmplist = comps_hslist_create();
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_objradix.c:702:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘**tmplist.first.data’
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:739:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:702:9: danger: use after ‘free’ of ‘*tmplist.95_41->first.data’; freed at [(6)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/5)
# 700| it = tmplist->first;
# 701| comps_hslist_remove(tmplist, tmplist->first);
# 702|-> tmp_subnodes = ((struct Pair*)it->data)->subnodes;
# 703| parent_pair = (struct Pair*) it->data;
# 704| //printf("key-part:%s\n", parent_pair->key);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:709: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 707| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 708| pair = malloc(sizeof(struct Pair));
# 709|-> pair->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
# 710|
# 711| if (parent_pair->key != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_objradix.c:709:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:708:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:708:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:709:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/4)
# 707| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 708| pair = malloc(sizeof(struct Pair));
# 709|-> pair->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
# 710|
# 711| if (parent_pair->key != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_objradix.c:715:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_ObjRTreeData *)it_43->data.key) + strlen(*(struct Pair *)_42->data.key) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:708:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:711:16: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:713:64: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:712:29: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:715:17: danger: argument 1 (‘malloc(strlen(*(COMPS_ObjRTreeData *)it_43->data.key) + strlen(*(struct Pair *)_42->data.key) + 1)’) from [(7)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 713| * (strlen(((COMPS_ObjRTreeData*)it->data)->key)
# 714| + strlen(parent_pair->key) + 1));
# 715|-> memcpy(pair->key, parent_pair->key,
# 716| sizeof(char) * strlen(parent_pair->key));
# 717| memcpy(pair->key + strlen(parent_pair->key),
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_objradix.c:723:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_ObjRTreeData *)it_43->data.key) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:708:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:711:16: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:722:63: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:721:29: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_objradix.c:723:17: danger: argument 1 (‘malloc(strlen(*(COMPS_ObjRTreeData *)it_43->data.key) + 1)’) from [(7)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 721| pair->key = malloc(sizeof(char)*
# 722| (strlen(((COMPS_ObjRTreeData*)it->data)->key) +1));
# 723|-> memcpy(pair->key, ((COMPS_ObjRTreeData*)it->data)->key,
# 724| sizeof(char)*(strlen(((COMPS_ObjRTreeData*)it->data)->key)+1));
# 725| }
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)**tmplist.first.data).key’
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:9: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_objradix.c:699:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_objradix.c:701:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:707:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_objradix.c:738:9: danger: second ‘free’ here; first ‘free’ was at [(5)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/4)
# 736| }
# 737| }
# 738|-> free(parent_pair->key);
# 739| free(parent_pair);
# 740| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_parse.c:293:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘alltext’
libcomps-0.1.24/libcomps/src/comps_parse.c:287:8: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_parse.c:288:39: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:288:19: acquire_memory: allocated here
libcomps-0.1.24/libcomps/src/comps_parse.c:289:12: release_memory: assuming ‘alltext’ is NULL
libcomps-0.1.24/libcomps/src/comps_parse.c:289:12: branch_true: following ‘true’ branch (when ‘alltext’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_parse.c:290:13: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:293:9: danger: dereference of NULL ‘alltext’
# 291| raise(SIGABRT);
# 292| }
# 293|-> alltext[0]=0;
# 294| }
# 295| while ((data = comps_hslist_shift(parsed->text_buffer)) != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_parse.c:297:19: warning[-Wanalyzer-null-argument]: use of NULL ‘alltext’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_parse.c:287:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_parse.c:287:8: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:295:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_parse.c:297:19: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:297:19: danger: argument 1 (‘alltext’) NULL where non-null expected
# 295| while ((data = comps_hslist_shift(parsed->text_buffer)) != NULL) {
# 296| //item_len = strlen((char*)data);
# 297|-> alltext = strcat(alltext, data);
# 298| free(data);
# 299| //index += item_len;
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_parse.c:449:31: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘it’
libcomps-0.1.24/libcomps/src/comps_parse.c:447:20: branch_true: following ‘true’ branch (when ‘attr_count > x’)...
libcomps-0.1.24/libcomps/src/comps_parse.c:448:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:448:50: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_parse.c:449:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:449:16: branch_true: following ‘true’ branch (when the strings are equal)...
libcomps-0.1.24/libcomps/src/comps_parse.c:450:21: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:450:20: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_parse.c:451:27: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:459:17: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_parse.c:447:20: branch_true: following ‘true’ branch (when ‘attr_count > x’)...
libcomps-0.1.24/libcomps/src/comps_parse.c:448:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:448:50: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_parse.c:449:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:449:31: danger: use after ‘free’ of ‘it’; freed at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
# 447| for (int x =0; x<attr_count; x++) {
# 448| for (COMPS_HSListItem *it = keys->first; it != NULL; it = it->next) {
# 449|-> if (strcmp((char*)it->data, info->attributes[x]->name) == 0) {
# 450| if (info->attributes[x]->val_check) {
# 451| val = comps_dict_get(elem->attrs, it->data);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_parse.c:466:39: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘it’
libcomps-0.1.24/libcomps/src/comps_parse.c:447:20: branch_true: following ‘true’ branch (when ‘attr_count > x’)...
libcomps-0.1.24/libcomps/src/comps_parse.c:448:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:448:50: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_parse.c:449:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:449:16: branch_true: following ‘true’ branch (when the strings are equal)...
libcomps-0.1.24/libcomps/src/comps_parse.c:450:21: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:450:20: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_parse.c:451:27: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:459:17: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_parse.c:464:46: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_parse.c:468:39: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_parse.c:466:39: danger: use after ‘free’ of ‘it’; freed at [(9)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/8)
# 464| for (COMPS_HSListItem *it = keys->first; it != NULL; it = it->next) {
# 465| comps_log_warning_x(parsed->log, COMPS_ERR_ATTR_UNKNOWN, 4,
# 466|-> comps_str(it->data), comps_str(info->name),
# 467| comps_num(XML_GetCurrentLineNumber(parsed->parser)),
# 468| comps_num(XML_GetCurrentColumnNumber(parsed->parser)));
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:129:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_radix.c:587:14: enter_function: entry to ‘comps_rtree_union’
libcomps-0.1.24/libcomps/src/comps_radix.c:589:11: call_function: calling ‘comps_rtree_clone’ from ‘comps_rtree_union’
# 127| new_data = NULL;
# 128| comps_hslist_destroy(&rtdata->subnodes);
# 129|-> rtdata->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;
# 130| rtdata->data = new_data;
# 131| comps_hslist_append(ret->subnodes, rtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:131:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_radix.c:587:14: enter_function: entry to ‘comps_rtree_union’
libcomps-0.1.24/libcomps/src/comps_radix.c:589:11: call_function: calling ‘comps_rtree_clone’ from ‘comps_rtree_union’
# 129| rtdata->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;
# 130| rtdata->data = new_data;
# 131|-> comps_hslist_append(ret->subnodes, rtdata, 0);
# 132|
# 133| comps_hslist_append(to_clone, rtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_radix.c:139:38: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*to_clone.first’
libcomps-0.1.24/libcomps/src/comps_radix.c:587:14: enter_function: entry to ‘comps_rtree_union’
libcomps-0.1.24/libcomps/src/comps_radix.c:589:11: call_function: calling ‘comps_rtree_clone’ from ‘comps_rtree_union’
# 137| while (to_clone->first) {
# 138| it2 = to_clone->first;
# 139|-> tmplist = ((COMPS_RTreeData*)it2->data)->subnodes;
# 140| comps_hslist_remove(to_clone, to_clone->first);
# 141|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:152:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
libcomps-0.1.24/libcomps/src/comps_radix.c:587:14: enter_function: entry to ‘comps_rtree_union’
libcomps-0.1.24/libcomps/src/comps_radix.c:589:11: call_function: calling ‘comps_rtree_clone’ from ‘comps_rtree_union’
# 150| new_data = NULL;
# 151| comps_hslist_destroy(&rtdata->subnodes);
# 152|-> rtdata->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;
# 153| rtdata->data = new_data;
# 154| comps_hslist_append(new_subnodes, rtdata, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:201:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rt’
libcomps-0.1.24/libcomps/src/comps_radix.c:587:14: enter_function: entry to ‘comps_rtree_union’
libcomps-0.1.24/libcomps/src/comps_radix.c:590:5: call_function: calling ‘comps_rtree_unite’ from ‘comps_rtree_union’
# 199| char ended;//, tmpch;
# 200|
# 201|-> if (rt->subnodes == NULL)
# 202| return;
# 203| if (rt->data_constructor) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:486: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 484| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 485| pair = malloc(sizeof(struct Pair));
# 486|-> pair->key = __comps_strcpy(((COMPS_RTreeData*)hsit->data)->key);
# 487| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 488| pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:486:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_radix.c:484:38: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:485:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:485:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:486:9: danger: ‘pair’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
# 484| for (hsit = rt->subnodes->first; hsit != NULL; hsit = hsit->next) {
# 485| pair = malloc(sizeof(struct Pair));
# 486|-> pair->key = __comps_strcpy(((COMPS_RTreeData*)hsit->data)->key);
# 487| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 488| pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:487: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 485| pair = malloc(sizeof(struct Pair));
# 486| pair->key = __comps_strcpy(((COMPS_RTreeData*)hsit->data)->key);
# 487|-> pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 488| pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
# 489| comps_hslist_append(to_process, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:488: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 486| pair->key = __comps_strcpy(((COMPS_RTreeData*)hsit->data)->key);
# 487| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 488|-> pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
# 489| comps_hslist_append(to_process, pair, 0);
# 490| }
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘*to_process.first’
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:508:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:509:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:517:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:519:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: danger: use after ‘free’ of ‘*to_process.first’; freed at [(7)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/6)
# 491| while (to_process->first) {
# 492| //oldpair = current_pair;
# 493|-> current_pair = to_process->first->data;
# 494| oldit = to_process->first;
# 495| comps_hslist_remove(to_process, to_process->first);
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_radix.c:496:13: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘current_pair’
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:508:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:509:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:517:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:518:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:13: danger: use after ‘free’ of ‘current_pair’; freed at [(8)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/7)
# 494| oldit = to_process->first;
# 495| comps_hslist_remove(to_process, to_process->first);
# 496|-> if (current_pair->data) {
# 497| if (keyvalpair == 0) {
# 498| comps_hslist_append(ret, __comps_strcpy(current_pair->key), 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:503: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 501| } else {
# 502| rtpair = malloc(sizeof(COMPS_RTreePair));
# 503|-> rtpair->key = __comps_strcpy(current_pair->key);
# 504| rtpair->data = current_pair->data;
# 505| comps_hslist_append(ret, rtpair, 0);
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:503:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rtpair’
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:497:16: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:497:16: branch_false: following ‘false’ branch (when ‘keyvalpair != 0’)...
libcomps-0.1.24/libcomps/src/comps_radix.c:499:23: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:499:23: branch_false: following ‘false’ branch (when ‘keyvalpair != 1’)...
libcomps-0.1.24/libcomps/src/comps_radix.c:502:26: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:502:26: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:503:17: danger: ‘rtpair’ could be NULL: unchecked value from [(9)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/8)
# 501| } else {
# 502| rtpair = malloc(sizeof(COMPS_RTreePair));
# 503|-> rtpair->key = __comps_strcpy(current_pair->key);
# 504| rtpair->data = current_pair->data;
# 505| comps_hslist_append(ret, rtpair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:504: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtpair
# 502| rtpair = malloc(sizeof(COMPS_RTreePair));
# 503| rtpair->key = __comps_strcpy(current_pair->key);
# 504|-> rtpair->data = current_pair->data;
# 505| comps_hslist_append(ret, rtpair, 0);
# 506| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:511: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 509| hsit != NULL; hsit = hsit->next, x++) {
# 510| pair = malloc(sizeof(struct Pair));
# 511|-> pair->key = __comps_strcat(current_pair->key,
# 512| ((COMPS_RTreeData*)hsit->data)->key);
# 513| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:511:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:509:14: branch_true: following ‘true’ branch (when ‘hsit’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:510:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:510:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:511:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/4)
# 509| hsit != NULL; hsit = hsit->next, x++) {
# 510| pair = malloc(sizeof(struct Pair));
# 511|-> pair->key = __comps_strcat(current_pair->key,
# 512| ((COMPS_RTreeData*)hsit->data)->key);
# 513| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:513: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 511| pair->key = __comps_strcat(current_pair->key,
# 512| ((COMPS_RTreeData*)hsit->data)->key);
# 513|-> pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 514| pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
# 515| comps_hslist_insert_at(to_process, x, pair, 0);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:514: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 512| ((COMPS_RTreeData*)hsit->data)->key);
# 513| pair->data = ((COMPS_RTreeData*)hsit->data)->data;
# 514|-> pair->subnodes = ((COMPS_RTreeData*)hsit->data)->subnodes;
# 515| comps_hslist_insert_at(to_process, x, pair, 0);
# 516| }
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_radix.c:517:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)((void *)current_pair)).key’
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:508:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:509:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:517:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:517:9: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_radix.c:491:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:493:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:496:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:508:21: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:509:14: branch_false: following ‘false’ branch (when ‘hsit’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:517:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:517:9: danger: second ‘free’ here; first ‘free’ was at [(7)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/6)
# 515| comps_hslist_insert_at(to_process, x, pair, 0);
# 516| }
# 517|-> free(current_pair->key);
# 518| free(current_pair);
# 519| free(oldit);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:535: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 533|
# 534| pair = malloc(sizeof(struct Pair));
# 535|-> pair->subnodes = rt2->subnodes;
# 536| pair->key = NULL;
# 537|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:535:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_radix.c:534:12: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:535:5: danger: ‘pair’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
# 533|
# 534| pair = malloc(sizeof(struct Pair));
# 535|-> pair->subnodes = rt2->subnodes;
# 536| pair->key = NULL;
# 537|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:536: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 534| pair = malloc(sizeof(struct Pair));
# 535| pair->subnodes = rt2->subnodes;
# 536|-> pair->key = NULL;
# 537|
# 538| tmplist = comps_hslist_create();
Error: GCC_ANALYZER_WARNING (CWE-416):
libcomps-0.1.24/libcomps/src/comps_radix.c:545:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘**tmplist.first.data’
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:582:9: release_memory: freed here
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:545:9: danger: use after ‘free’ of ‘*tmplist.73_42->first.data’; freed at [(4)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/3)
# 543| it = tmplist->first;
# 544| comps_hslist_remove(tmplist, tmplist->first);
# 545|-> tmp_subnodes = ((struct Pair*)it->data)->subnodes;
# 546| parent_pair = (struct Pair*) it->data;
# 547| free(it);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:551: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pair
# 549| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 550| pair = malloc(sizeof(struct Pair));
# 551|-> pair->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;
# 552|
# 553| if (parent_pair->key != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_radix.c:551:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pair’
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:549:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:550:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:550:20: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:551:13: danger: ‘pair’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/4)
# 549| for (it = tmp_subnodes->first; it != NULL; it=it->next) {
# 550| pair = malloc(sizeof(struct Pair));
# 551|-> pair->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;
# 552|
# 553| if (parent_pair->key != NULL) {
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_radix.c:557:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_RTreeData *)it_44->data.key) + strlen(*(struct Pair *)_43->data.key) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:549:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:550:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:553:16: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:555:61: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:554:29: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:557:17: danger: argument 1 (‘malloc(strlen(*(COMPS_RTreeData *)it_44->data.key) + strlen(*(struct Pair *)_43->data.key) + 1)’) from [(7)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 555| * (strlen(((COMPS_RTreeData*)it->data)->key)
# 556| + strlen(parent_pair->key) + 1));
# 557|-> memcpy(pair->key, parent_pair->key,
# 558| sizeof(char) * strlen(parent_pair->key));
# 559| memcpy(pair->key + strlen(parent_pair->key),
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_radix.c:565:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(*(COMPS_RTreeData *)it_44->data.key) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:549:40: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:550:20: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:563:29: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_radix.c:565:17: danger: argument 1 (‘malloc(strlen(*(COMPS_RTreeData *)it_44->data.key) + 1)’) from [(5)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 563| pair->key = malloc(sizeof(char)*
# 564| (strlen(((COMPS_RTreeData*)it->data)->key) +1));
# 565|-> memcpy(pair->key, ((COMPS_RTreeData*)it->data)->key,
# 566| sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1));
# 567| }
Error: GCC_ANALYZER_WARNING (CWE-415):
libcomps-0.1.24/libcomps/src/comps_radix.c:581:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘((struct Pair)*(void *)**tmplist.first.data).key’
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:581:9: release_memory: first ‘free’ here
libcomps-0.1.24/libcomps/src/comps_radix.c:542:12: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/src/comps_radix.c:544:9: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:549:40: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_radix.c:581:14: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_radix.c:581:9: danger: second ‘free’ here; first ‘free’ was at [(3)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/2)
# 579| }
# 580| }
# 581|-> free(parent_pair->key);
# 582| free(parent_pair);
# 583| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_set.c:132:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘not_processed1’
libcomps-0.1.24/libcomps/src/comps_set.c:137:6: enter_function: entry to ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:153:41: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:156:10: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:156:41: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:159:10: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:163:13: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:163:13: call_function: inlined call to ‘comps_set_is_empty’ from ‘comps_set_cmp’
# 130|
# 131| inline char comps_set_is_empty(COMPS_Set *set) {
# 132|-> if (set->data->first == NULL) {
# 133| return 1;
# 134| } else return 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_set.c:132:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘not_processed2’
libcomps-0.1.24/libcomps/src/comps_set.c:137:6: enter_function: entry to ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:145:22: call_function: calling ‘comps_set_create’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:145:22: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_create’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: release_memory: ‘not_processed2’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:156:41: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:159:10: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:163:13: call_function: inlined call to ‘comps_set_is_empty’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:164:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:164:13: release_memory: ‘not_processed2’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:164:13: call_function: inlined call to ‘comps_set_is_empty’ from ‘comps_set_cmp’
# 130|
# 131| inline char comps_set_is_empty(COMPS_Set *set) {
# 132|-> if (set->data->first == NULL) {
# 133| return 1;
# 134| } else return 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_set.c:154:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘not_processed1’
libcomps-0.1.24/libcomps/src/comps_set.c:137:6: enter_function: entry to ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:153:41: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:154:43: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:154:43: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:154:9: danger: dereference of NULL ‘not_processed1’
# 152| &free, &comps_set_index_cmp);
# 153| for (x = 0, it = set1->data->first; it!= NULL; it = it->next, x++) {
# 154|-> comps_hslist_append(not_processed1->data, &x, 1);
# 155| }
# 156| for (x = 0, it = set2->data->first; it!= NULL; it = it->next, x++) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_set.c:157:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘not_processed1’
libcomps-0.1.24/libcomps/src/comps_set.c:137:6: enter_function: entry to ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:153:41: branch_false: following ‘false’ branch (when ‘it’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:156:10: branch_false: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:156:41: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:157:43: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:157:43: release_memory: ‘not_processed1’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:157:9: danger: dereference of NULL ‘not_processed2’
# 155| }
# 156| for (x = 0, it = set2->data->first; it!= NULL; it = it->next, x++) {
# 157|-> comps_hslist_append(not_processed2->data, &x, 1);
# 158| }
# 159| it = set1->data->first;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_set.c:157:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘not_processed2’
libcomps-0.1.24/libcomps/src/comps_set.c:137:6: enter_function: entry to ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:145:22: call_function: calling ‘comps_set_create’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:145:22: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_create’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:147:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: release_memory: ‘not_processed2’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: call_function: calling ‘comps_set_init’ from ‘comps_set_cmp’
libcomps-0.1.24/libcomps/src/comps_set.c:150:5: return_function: returning to ‘comps_set_cmp’ from ‘comps_set_init’
libcomps-0.1.24/libcomps/src/comps_set.c:156:41: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_set.c:157:43: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_set.c:157:43: release_memory: ‘not_processed2’ is NULL
libcomps-0.1.24/libcomps/src/comps_set.c:157:9: danger: dereference of NULL ‘not_processed2’
# 155| }
# 156| for (x = 0, it = set2->data->first; it!= NULL; it = it->next, x++) {
# 157|-> comps_hslist_append(not_processed2->data, &x, 1);
# 158| }
# 159| it = set1->data->first;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:57: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 55| }
# 56| ret = malloc(sizeof(char) * (strlen(_bool)+1));
# 57|-> ret[0] = 0;
# 58| strcat(ret, _bool);
# 59| return ret;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:57:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/src/comps_utils.c:56:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_utils.c:57:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 55| }
# 56| ret = malloc(sizeof(char) * (strlen(_bool)+1));
# 57|-> ret[0] = 0;
# 58| strcat(ret, _bool);
# 59| return ret;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:58: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 56| ret = malloc(sizeof(char) * (strlen(_bool)+1));
# 57| ret[0] = 0;
# 58|-> strcat(ret, _bool);
# 59| return ret;
# 60| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:93: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: arches_str
# 91| if (!archlist || !((COMPS_ObjList*)archlist)->len) {
# 92| arches_str = malloc(sizeof(char));
# 93|-> arches_str[0] = 0;
# 94| return arches_str;
# 95| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:93:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘arches_str’
libcomps-0.1.24/libcomps/src/comps_utils.c:92:22: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_utils.c:93:9: danger: ‘arches_str’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 91| if (!archlist || !((COMPS_ObjList*)archlist)->len) {
# 92| arches_str = malloc(sizeof(char));
# 93|-> arches_str[0] = 0;
# 94| return arches_str;
# 95| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:103: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: arches_str
# 101| }
# 102| arches_str = malloc(sizeof(char) * (total_len));
# 103|-> arches_str[0]=0;
# 104|
# 105| x = 0;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:103:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘arches_str’
libcomps-0.1.24/libcomps/src/comps_utils.c:91:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/comps_utils.c:102:18: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_utils.c:103:5: danger: ‘arches_str’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
# 101| }
# 102| arches_str = malloc(sizeof(char) * (total_len));
# 103|-> arches_str[0]=0;
# 104|
# 105| x = 0;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:111: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: arches_str
# 109| strcat(arches_str, " ");
# 110| }
# 111|-> strcat(arches_str, arches[x]);
# 112| free(arches[x]);
# 113| return arches_str;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:130: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 128| char *ret;
# 129| ret = malloc(sizeof(char)*(strlen(str)+1));
# 130|-> return memcpy(ret, str, sizeof(char)*(strlen(str)+1));
# 131| }
# 132|
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_utils.c:130:12: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_utils.c:129:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_utils.c:130:12: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 128| char *ret;
# 129| ret = malloc(sizeof(char)*(strlen(str)+1));
# 130|-> return memcpy(ret, str, sizeof(char)*(strlen(str)+1));
# 131| }
# 132|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:136: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 134| char *ret;
# 135| ret = malloc(sizeof(char)*(strlen(str1)+strlen(str2)+1));
# 136|-> memcpy(ret, str1, sizeof(char)*(strlen(str1)+1));
# 137| strcat(ret, str2);
# 138| return ret;
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_utils.c:136:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_utils.c:135:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_utils.c:136:5: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 134| char *ret;
# 135| ret = malloc(sizeof(char)*(strlen(str1)+strlen(str2)+1));
# 136|-> memcpy(ret, str1, sizeof(char)*(strlen(str1)+1));
# 137| strcat(ret, str2);
# 138| return ret;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/comps_utils.c:137: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 135| ret = malloc(sizeof(char)*(strlen(str1)+strlen(str2)+1));
# 136| memcpy(ret, str1, sizeof(char)*(strlen(str1)+1));
# 137|-> strcat(ret, str2);
# 138| return ret;
# 139| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_validate.c:59:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libcomps-0.1.24/libcomps/src/comps_validate.c:52:60: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_validate.c:54:41: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_validate.c:59:9: danger: argument 2 (‘*(COMPS_ValErr *)it_4->comps_obj.err_msg’) NULL where non-null expected
# 57| (oldlen + strlen(prefix) +1) *
# 58| sizeof(char));
# 59|-> memmove(((COMPS_ValErr*)it->comps_obj)->err_msg + (strlen(prefix) *sizeof(char)),
# 60| ((COMPS_ValErr*)it->comps_obj)->err_msg, (oldlen+1) * sizeof(char));
# 61| memcpy(((COMPS_ValErr*)it->comps_obj)->err_msg, prefix,
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/comps_validate.c:195:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘msg’ where non-null expected
libcomps-0.1.24/libcomps/src/comps_validate.c:180:10: branch_true: following ‘true’ branch (when ‘it’ is non-NULL)...
libcomps-0.1.24/libcomps/src/comps_validate.c:182:45: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_validate.c:185:16: branch_true: following ‘true’ branch (when ‘valres’ is NULL)...
libcomps-0.1.24/libcomps/src/comps_validate.c:186:47: branch_true: ...to here
libcomps-0.1.24/libcomps/src/comps_validate.c:193:19: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/comps_validate.c:195:13: danger: argument 1 (‘msg’) from [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 193| msg = malloc(sizeof(char) * (strlen(msg_fmt)-3)+digits_count(x)\
# 194| +digits_count(index));
# 195|-> sprintf(msg, msg_fmt, index, x);
# 196| v_err->err_msg = msg;
# 197| comps_objlist_append_x(((COMPS_ValErrResult*)valres)->err_list,
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:60: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: *options
# 58| &(*options)->bao_explicit,
# 59| &(*options)->arch_output};
# 60|-> **options = COMPS_XMLDefaultOptions;
# 61|
# 62| if (!PyDict_Check(pobj)) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:60:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(15)’
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:44:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:60:5: danger: ‘malloc(15)’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 58| &(*options)->bao_explicit,
# 59| &(*options)->arch_output};
# 60|-> **options = COMPS_XMLDefaultOptions;
# 61|
# 62| if (!PyDict_Check(pobj)) {
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:92: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: *options
# 90| &(*options)->default_default};
# 91| int *props1[] = {&(*options)->default_pkgtype};
# 92|-> **options = COMPS_DDefaultsOptions;
# 93|
# 94| if (!PyDict_Check(pobj)) {
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:92:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(8)’
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:87:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/python/src/pycomps.c:92:5: danger: ‘malloc(8)’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
# 90| &(*options)->default_default};
# 91| int *props1[] = {&(*options)->default_pkgtype};
# 92|-> **options = COMPS_DDefaultsOptions;
# 93|
# 94| if (!PyDict_Check(pobj)) {
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:126:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*ret’ where non-null expected
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:112:8: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:116:13: branch_false: ...to here
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:117:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:121:15: branch_false: ...to here
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:122:12: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:125:39: branch_false: ...to here
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:125:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:126:9: danger: argument 1 (‘malloc(strlen(PyBytes_AsString(PyUnicode_AsUTF8String(val))) + 1)’) from [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6) could be NULL where non-null expected
# 124| }
# 125| *ret = malloc(sizeof(char) * (strlen(tmp)+1));
# 126|-> memcpy(*ret, tmp, sizeof(char) * (strlen(tmp)+1));
# 127| Py_XDECREF(o);
# 128| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:126:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘tmp’ where non-null expected
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:30:15: enter_function: entry to ‘__pycomps_unicode_in’
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:32:5: call_function: calling ‘__pycomps_PyUnicode_AsString’ from ‘__pycomps_unicode_in’
# 124| }
# 125| *ret = malloc(sizeof(char) * (strlen(tmp)+1));
# 126|-> memcpy(*ret, tmp, sizeof(char) * (strlen(tmp)+1));
# 127| Py_XDECREF(o);
# 128| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 169| void *ret;
# 170| ret = malloc(sizeof(char)*(strlen(str)+1));
# 171|-> memcpy(ret, str, sizeof(char)*(strlen(str)+1));
# 172| return ret;
# 173| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:171:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:170:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/src/python/src/pycomps_utils.c:171:5: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 169| void *ret;
# 170| ret = malloc(sizeof(char)*(strlen(str)+1));
# 171|-> memcpy(ret, str, sizeof(char)*(strlen(str)+1));
# 172| return ret;
# 173| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:36: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 34| struct _teststruct *ret;
# 35| ret = malloc(sizeof(struct _teststruct));
# 36|-> ret->testdata = malloc(sizeof(char)*(strlen(testdata)+1));
# 37| memcpy(ret->testdata, testdata, sizeof(char)*(strlen(testdata)+1));
# 38| return ret;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:36:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:35:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:36:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 34| struct _teststruct *ret;
# 35| ret = malloc(sizeof(struct _teststruct));
# 36|-> ret->testdata = malloc(sizeof(char)*(strlen(testdata)+1));
# 37| memcpy(ret->testdata, testdata, sizeof(char)*(strlen(testdata)+1));
# 38| return ret;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:37: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 35| ret = malloc(sizeof(struct _teststruct));
# 36| ret->testdata = malloc(sizeof(char)*(strlen(testdata)+1));
# 37|-> memcpy(ret->testdata, testdata, sizeof(char)*(strlen(testdata)+1));
# 38| return ret;
# 39| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_brtree.c:37:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc(strlen(testdata) + 1)’ where non-null expected
libcomps-0.1.24/libcomps/tests/check_brtree.c:36:21: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:37:5: danger: argument 1 (‘malloc(strlen(testdata) + 1)’) from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 35| ret = malloc(sizeof(struct _teststruct));
# 36| ret->testdata = malloc(sizeof(char)*(strlen(testdata)+1));
# 37|-> memcpy(ret->testdata, testdata, sizeof(char)*(strlen(testdata)+1));
# 38| return ret;
# 39| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:76: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 74|
# 75| ret = malloc(sizeof(struct _key));
# 76|-> ret->key = malloc(sizeof(char)*len);
# 77| ret->key = memcpy(ret->key, ((struct _key*)key)->key, sizeof(char)*len);
# 78| ret->keylen = len;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:77: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 75| ret = malloc(sizeof(struct _key));
# 76| ret->key = malloc(sizeof(char)*len);
# 77|-> ret->key = memcpy(ret->key, ((struct _key*)key)->key, sizeof(char)*len);
# 78| ret->keylen = len;
# 79| /*printf("clonned key\n");
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:77:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:75:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:77:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
# 75| ret = malloc(sizeof(struct _key));
# 76| ret->key = malloc(sizeof(char)*len);
# 77|-> ret->key = memcpy(ret->key, ((struct _key*)key)->key, sizeof(char)*len);
# 78| ret->keylen = len;
# 79| /*printf("clonned key\n");
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_brtree.c:77:16: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc((long unsigned int)len)’ where non-null expected
libcomps-0.1.24/libcomps/tests/check_brtree.c:76:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:77:16: danger: argument 1 (‘malloc((long unsigned int)len)’) from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 75| ret = malloc(sizeof(struct _key));
# 76| ret->key = malloc(sizeof(char)*len);
# 77|-> ret->key = memcpy(ret->key, ((struct _key*)key)->key, sizeof(char)*len);
# 78| ret->keylen = len;
# 79| /*printf("clonned key\n");
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:78: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 76| ret->key = malloc(sizeof(char)*len);
# 77| ret->key = memcpy(ret->key, ((struct _key*)key)->key, sizeof(char)*len);
# 78|-> ret->keylen = len;
# 79| /*printf("clonned key\n");
# 80| print_key(ret);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 87| unsigned char i;
# 88| ret = malloc(sizeof(struct _key));
# 89|-> ret->key = malloc(sizeof(char)*sizeof(x));
# 90| for (i = 0; i<sizeof(x); i++) {
# 91| ret->key[i] = ((char*)&x)[sizeof(x)-i-1];
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:89:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:88:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:89:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
# 87| unsigned char i;
# 88| ret = malloc(sizeof(struct _key));
# 89|-> ret->key = malloc(sizeof(char)*sizeof(x));
# 90| for (i = 0; i<sizeof(x); i++) {
# 91| ret->key[i] = ((char*)&x)[sizeof(x)-i-1];
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 89| ret->key = malloc(sizeof(char)*sizeof(x));
# 90| for (i = 0; i<sizeof(x); i++) {
# 91|-> ret->key[i] = ((char*)&x)[sizeof(x)-i-1];
# 92| }
# 93| /*printf("make_key\n");
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:91:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(8)’
libcomps-0.1.24/libcomps/tests/check_brtree.c:89:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:90:17: branch_true: following ‘true’ branch (when ‘i != 8’)...
libcomps-0.1.24/libcomps/tests/check_brtree.c:91:35: branch_true: ...to here
libcomps-0.1.24/libcomps/tests/check_brtree.c:91:9: danger: ‘malloc(8) + (sizetype)i’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
# 89| ret->key = malloc(sizeof(char)*sizeof(x));
# 90| for (i = 0; i<sizeof(x); i++) {
# 91|-> ret->key[i] = ((char*)&x)[sizeof(x)-i-1];
# 92| }
# 93| /*printf("make_key\n");
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:99: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 97| }*/
# 98| //printf("---\n");
# 99|-> ret->keylen = sizeof(x);
# 100| return ret;
# 101| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:135: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 133| ret = malloc(sizeof(struct _key));
# 134| //ret->key = ((struct _key*)key)->key;
# 135|-> ret->key = malloc(sizeof(char)*len);
# 136| //memset(((char*)&ret->key), 0, offset);
# 137|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:135:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:133:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:135:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
# 133| ret = malloc(sizeof(struct _key));
# 134| //ret->key = ((struct _key*)key)->key;
# 135|-> ret->key = malloc(sizeof(char)*len);
# 136| //memset(((char*)&ret->key), 0, offset);
# 137|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:138: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 136| //memset(((char*)&ret->key), 0, offset);
# 137|
# 138|-> memcpy(ret->key, ((struct _key*)key)->key+offset, len-offset);
# 139| //printf("subkey offset:%d len:%d\n", offset, len);
# 140| ret->keylen = len-offset;
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_brtree.c:138:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘malloc((long unsigned int)len)’ where non-null expected
libcomps-0.1.24/libcomps/tests/check_brtree.c:135:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:138:5: danger: argument 1 (‘malloc((long unsigned int)len)’) from [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 136| //memset(((char*)&ret->key), 0, offset);
# 137|
# 138|-> memcpy(ret->key, ((struct _key*)key)->key+offset, len-offset);
# 139| //printf("subkey offset:%d len:%d\n", offset, len);
# 140| ret->keylen = len-offset;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:140: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 138| memcpy(ret->key, ((struct _key*)key)->key+offset, len-offset);
# 139| //printf("subkey offset:%d len:%d\n", offset, len);
# 140|-> ret->keylen = len-offset;
# 141| /*printf("subkey: ");
# 142| print_key_(ret);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:156: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 154| unsigned int i, len;
# 155| ret = malloc(sizeof(struct _key));
# 156|-> ret->key = malloc(sizeof(char)*(((struct _key*)key1)->keylen +\
# 157| ((struct _key*)key2)->keylen));
# 158|
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:156:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:155:11: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:156:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
# 154| unsigned int i, len;
# 155| ret = malloc(sizeof(struct _key));
# 156|-> ret->key = malloc(sizeof(char)*(((struct _key*)key1)->keylen +\
# 157| ((struct _key*)key2)->keylen));
# 158|
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:163: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 161|
# 162| for (i = 0; i < ((struct _key*)key1)->keylen; i++)
# 163|-> ret->key[i] = ((struct _key*)key1)->key[i];
# 164| ret->keylen = i;
# 165| len = i;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:163:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(*(struct _key *)key1.keylen + *(struct _key *)key2.keylen))’
libcomps-0.1.24/libcomps/tests/check_brtree.c:156:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:162:17: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/tests/check_brtree.c:163:23: branch_true: ...to here
libcomps-0.1.24/libcomps/tests/check_brtree.c:163:9: danger: ‘malloc((long unsigned int)(*(struct _key *)key1.keylen + *(struct _key *)key2.keylen)) + (sizetype)i’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
# 161|
# 162| for (i = 0; i < ((struct _key*)key1)->keylen; i++)
# 163|-> ret->key[i] = ((struct _key*)key1)->key[i];
# 164| ret->keylen = i;
# 165| len = i;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:164: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 162| for (i = 0; i < ((struct _key*)key1)->keylen; i++)
# 163| ret->key[i] = ((struct _key*)key1)->key[i];
# 164|-> ret->keylen = i;
# 165| len = i;
# 166| //printf("len: %d\n", len);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:168: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 166| //printf("len: %d\n", len);
# 167| for (i = 0; i < ((struct _key*)key2)->keylen; i++)
# 168|-> ret->key[i+len] = ((struct _key*)key2)->key[i];
# 169| //printf("len2: %d\n", ((struct _key*)key2)->keylen);
# 170| ret->keylen += i;
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:168:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc((long unsigned int)(*(struct _key *)key1.keylen + *(struct _key *)key2.keylen))’
libcomps-0.1.24/libcomps/tests/check_brtree.c:156:16: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:162:17: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/tests/check_brtree.c:162:17: branch_false: ...to here
libcomps-0.1.24/libcomps/tests/check_brtree.c:167:17: branch_true: following ‘true’ branch...
libcomps-0.1.24/libcomps/tests/check_brtree.c:168:27: branch_true: ...to here
libcomps-0.1.24/libcomps/tests/check_brtree.c:168:9: danger: ‘malloc((long unsigned int)(*(struct _key *)key1.keylen + *(struct _key *)key2.keylen)) + (sizetype)(i + i)’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
# 166| //printf("len: %d\n", len);
# 167| for (i = 0; i < ((struct _key*)key2)->keylen; i++)
# 168|-> ret->key[i+len] = ((struct _key*)key2)->key[i];
# 169| //printf("len2: %d\n", ((struct _key*)key2)->keylen);
# 170| ret->keylen += i;
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:170: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 168| ret->key[i+len] = ((struct _key*)key2)->key[i];
# 169| //printf("len2: %d\n", ((struct _key*)key2)->keylen);
# 170|-> ret->keylen += i;
# 171| return ret;
# 172| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:191: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 189| void* int_cloner(void * int_v) {
# 190| void * ret = malloc(sizeof(int));
# 191|-> memcpy(ret, int_v, sizeof(int));
# 192| return ret;
# 193| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:191:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_brtree.c:190:18: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:191:5: danger: ‘ret’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
# 189| void* int_cloner(void * int_v) {
# 190| void * ret = malloc(sizeof(int));
# 191|-> memcpy(ret, int_v, sizeof(int));
# 192| return ret;
# 193| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_brtree.c:197: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 195| void* str_cloner(void *str) {
# 196| void *ret = malloc(sizeof(char)* (strlen((char*)str)+1));
# 197|-> memcpy(ret, str, (strlen((char*)str)+1));
# 198| return ret;
# 199| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_brtree.c:197:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/tests/check_brtree.c:196:17: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_brtree.c:197:5: danger: argument 1 (‘ret’) from [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
# 195| void* str_cloner(void *str) {
# 196| void *ret = malloc(sizeof(char)* (strlen((char*)str)+1));
# 197|-> memcpy(ret, str, (strlen((char*)str)+1));
# 198| return ret;
# 199| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_parse.c:206:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*<unknown>.args + (long unsigned int)i * 8’
libcomps-0.1.24/libcomps/tests/check_parse.c:200:19: acquire_memory: this call could return NULL
libcomps-0.1.24/libcomps/tests/check_parse.c:204:19: branch_true: following ‘true’ branch (when ‘i < n’)...
libcomps-0.1.24/libcomps/tests/check_parse.c:205:9: branch_true: ...to here
libcomps-0.1.24/libcomps/tests/check_parse.c:206:9: danger: ‘*<unknown>.args + (long unsigned int)i * 8’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
# 204| for (int i=0; i<n; i++) {
# 205| val = va_arg(arg_list, COMPS_Object*);
# 206|-> entry->args[i] = val;
# 207| }
# 208| va_end(arg_list);
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_rtree.c:40: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 38| void* int_cloner(void * int_v) {
# 39| void * ret = malloc(sizeof(int));
# 40|-> memcpy(ret, int_v, sizeof(int));
# 41| return ret;
# 42| }
Error: GCC_ANALYZER_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_rtree.c:40:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ret’
libcomps-0.1.24/libcomps/tests/check_rtree.c:127:5: enter_function: entry to ‘main’
libcomps-0.1.24/libcomps/tests/check_rtree.c:148:5: call_function: inlined call to ‘int_cloner’ from ‘main’
# 38| void* int_cloner(void * int_v) {
# 39| void * ret = malloc(sizeof(int));
# 40|-> memcpy(ret, int_v, sizeof(int));
# 41| return ret;
# 42| }
Error: CPPCHECK_WARNING (CWE-476):
libcomps-0.1.24/libcomps/tests/check_rtree.c:46: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
# 44| void* str_cloner(void *str) {
# 45| void *ret = malloc(sizeof(char)* (strlen((char*)str)+1));
# 46|-> memcpy(ret, str, (strlen((char*)str)+1));
# 47| return ret;
# 48| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_rtree.c:46:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ret’ where non-null expected
libcomps-0.1.24/libcomps/tests/check_rtree.c:127:5: enter_function: entry to ‘main’
libcomps-0.1.24/libcomps/tests/check_rtree.c:269:12: call_function: calling ‘load_acrodict’ from ‘main’
# 44| void* str_cloner(void *str) {
# 45| void *ret = malloc(sizeof(char)* (strlen((char*)str)+1));
# 46|-> memcpy(ret, str, (strlen((char*)str)+1));
# 47| return ret;
# 48| }
Error: GCC_ANALYZER_WARNING (CWE-688):
libcomps-0.1.24/libcomps/tests/check_utils.c:51:5: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
libcomps-0.1.24/libcomps/tests/check_utils.c:51:5: branch_false: following ‘false’ branch...
libcomps-0.1.24/libcomps/tests/check_utils.c:51:5: branch_false: ...to here
libcomps-0.1.24/libcomps/tests/check_utils.c:51:5: danger: argument 1 (‘<unknown>’) NULL where non-null expected
#argument 1 of ‘__builtin_puts’ must be non-null
# 49| printf("%s type=", str);
# 50| free(str);
# 51|-> printf("%s\n", pkg_type2str(((COMPS_DocGroupPackage*)obj)->type));
# 52| }
# 53|