Error: GCC_ANALYZER_WARNING (CWE-775): [#def1] usbutils-019/lsusb-t.c:235:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&path, 0)’ usbutils-019/lsusb-t.c:758:5: enter_function: entry to ‘lsusb_t’ usbutils-019/lsusb-t.c:761:12: branch_true: following ‘true’ branch... usbutils-019/lsusb-t.c:762:17: branch_true: ...to here usbutils-019/lsusb-t.c:762:17: call_function: calling ‘walk_usb_devices’ from ‘lsusb_t’ # 233| memset(buf, 0, sizeof(buf)); # 234| r = read(fd, buf, sizeof(buf) - 1); # 235|-> close(fd); # 236| if (r < 0) # 237| goto error; Error: GCC_ANALYZER_WARNING (CWE-775): [#def2] usbutils-019/lsusb-t.c:259:13: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&path, 0)’ usbutils-019/lsusb-t.c:758:5: enter_function: entry to ‘lsusb_t’ usbutils-019/lsusb-t.c:761:12: branch_true: following ‘true’ branch... usbutils-019/lsusb-t.c:762:17: branch_true: ...to here usbutils-019/lsusb-t.c:762:17: call_function: calling ‘walk_usb_devices’ from ‘lsusb_t’ # 257| if (fd < 0) # 258| goto error; # 259|-> r = read(fd, buf, len); # 260| close(fd); # 261| if (r > 0 && r < len) { Error: GCC_ANALYZER_WARNING (CWE-401): [#def3] usbutils-019/lsusb-t.c:510:22: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir(&sys_bus_usb_devices)’ usbutils-019/lsusb-t.c:758:5: enter_function: entry to ‘lsusb_t’ usbutils-019/lsusb-t.c:760:21: acquire_memory: allocated here usbutils-019/lsusb-t.c:761:12: branch_true: following ‘true’ branch... usbutils-019/lsusb-t.c:762:17: branch_true: ...to here usbutils-019/lsusb-t.c:762:17: call_function: calling ‘walk_usb_devices’ from ‘lsusb_t’ # 508| { # 509| struct dirent *de; # 510|-> while ((de = readdir(sbud))) # 511| inspect_bus_entry(de->d_name); # 512| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def4] usbutils-019/lsusb.c:176:19: warning[-Wanalyzer-malloc-leak]: leak of ‘bos_desc’ usbutils-019/lsusb.c:3577:13: enter_function: entry to ‘dump_bos_descriptor’ usbutils-019/lsusb.c:3596:12: branch_false: following ‘false’ branch... usbutils-019/lsusb.c:3598:18: branch_false: ...to here usbutils-019/lsusb.c:3598:17: branch_false: following ‘false’ branch... usbutils-019/lsusb.c:3610:12: branch_false: following ‘false’ branch... usbutils-019/lsusb.c:3616:20: branch_false: ...to here usbutils-019/lsusb.c:3616:20: acquire_memory: allocated here usbutils-019/lsusb.c:3617:12: branch_false: following ‘false’ branch (when ‘bos_desc’ is non-NULL)... usbutils-019/lsusb.c:3619:9: branch_false: ...to here usbutils-019/lsusb.c:3621:15: call_function: inlined call to ‘typesafe_control_msg’ from ‘dump_bos_descriptor’ # 174| unsigned char *bytes, unsigned size, int timeout) # 175| { # 176|-> int ret = libusb_control_transfer(dev, requesttype, request, value, # 177| idx, bytes, size, timeout); # 178| Error: GCC_ANALYZER_WARNING (CWE-775): [#def5] usbutils-019/sysfs.c:74:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&path, 0)’ usbutils-019/sysfs.c:64:14: acquire_resource: opened here usbutils-019/sysfs.c:66:12: branch_false: following ‘false’ branch... usbutils-019/sysfs.c:69:13: branch_false: ...to here usbutils-019/sysfs.c:74:9: danger: ‘open(&path, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) # 72| buf[n-1] = '\0'; // Turn newline into null terminator # 73| # 74|-> close(fd); # 75| return n; # 76| } Error: GCC_ANALYZER_WARNING (CWE-401): [#def6] usbutils-019/usbhid-dump/dev.c:35:11: warning[-Wanalyzer-malloc-leak]: leak of ‘dev’ usbutils-019/usbhid-dump/dev.c:27:5: branch_true: following ‘true’ branch (when ‘lusb_dev’ is non-NULL)... usbutils-019/usbhid-dump/dev.c:29:11: branch_true: ...to here usbutils-019/usbhid-dump/dev.c:29:11: acquire_memory: allocated here usbutils-019/usbhid-dump/dev.c:30:8: branch_false: following ‘false’ branch (when ‘dev’ is non-NULL)... usbutils-019/usbhid-dump/dev.c:33:5: branch_false: ...to here usbutils-019/usbhid-dump/dev.c:35:11: throw: if ‘libusb_open’ throws an exception... usbutils-019/usbhid-dump/dev.c:35:11: danger: ‘dev’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2) # 33| dev->next = NULL; # 34| # 35|-> err = libusb_open(lusb_dev, &dev->handle); # 36| if (err != LIBUSB_SUCCESS) # 37| { Error: GCC_ANALYZER_WARNING (CWE-401): [#def7] usbutils-019/usbhid-dump/iface.c:49:16: warning[-Wanalyzer-malloc-leak]: leak of ‘iface’ usbutils-019/usbhid-dump/iface.c:34:13: acquire_memory: allocated here usbutils-019/usbhid-dump/iface.c:35:8: branch_false: following ‘false’ branch (when ‘iface’ is non-NULL)... usbutils-019/usbhid-dump/iface.c:38:5: branch_false: ...to here usbutils-019/usbhid-dump/iface.c:49:16: throw: if ‘libusb_get_device’ throws an exception... usbutils-019/usbhid-dump/iface.c:49:16: danger: ‘iface’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) # 47| # 48| /* Format address string */ # 49|-> lusb_dev = libusb_get_device(dev->handle); # 50| rc = snprintf(iface->addr_str, sizeof(iface->addr_str), # 51| "%.3hhu:%.3hhu:%.3hhu", Error: GCC_ANALYZER_WARNING (CWE-401): [#def8] usbutils-019/usbhid-dump/iface.c:52:19: warning[-Wanalyzer-malloc-leak]: leak of ‘iface’ usbutils-019/usbhid-dump/iface.c:34:13: acquire_memory: allocated here usbutils-019/usbhid-dump/iface.c:35:8: branch_false: following ‘false’ branch (when ‘iface’ is non-NULL)... usbutils-019/usbhid-dump/iface.c:38:5: branch_false: ...to here usbutils-019/usbhid-dump/iface.c:52:19: throw: if ‘libusb_get_bus_number’ throws an exception... usbutils-019/usbhid-dump/iface.c:52:19: danger: ‘iface’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) # 50| rc = snprintf(iface->addr_str, sizeof(iface->addr_str), # 51| "%.3hhu:%.3hhu:%.3hhu", # 52|-> libusb_get_bus_number(lusb_dev), # 53| libusb_get_device_address(lusb_dev), # 54| number); Error: GCC_ANALYZER_WARNING (CWE-401): [#def9] usbutils-019/usbhid-dump/iface.c:53:19: warning[-Wanalyzer-malloc-leak]: leak of ‘iface’ usbutils-019/usbhid-dump/iface.c:34:13: acquire_memory: allocated here usbutils-019/usbhid-dump/iface.c:35:8: branch_false: following ‘false’ branch (when ‘iface’ is non-NULL)... usbutils-019/usbhid-dump/iface.c:38:5: branch_false: ...to here usbutils-019/usbhid-dump/iface.c:53:19: throw: if ‘libusb_get_device_address’ throws an exception... usbutils-019/usbhid-dump/iface.c:53:19: danger: ‘iface’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0) # 51| "%.3hhu:%.3hhu:%.3hhu", # 52| libusb_get_bus_number(lusb_dev), # 53|-> libusb_get_device_address(lusb_dev), # 54| number); # 55| (void)rc; Error: GCC_ANALYZER_WARNING (CWE-401): [#def10] usbutils-019/usbmisc.c:138:19: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’ usbutils-019/usbmisc.c:137:21: acquire_memory: allocated here usbutils-019/usbmisc.c:138:19: throw: if ‘libusb_get_string_descriptor_ascii’ throws an exception... usbutils-019/usbmisc.c:138:19: danger: ‘buf’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0) # 136| { # 137| char *buf = malloc(size); # 138|-> int ret = libusb_get_string_descriptor_ascii(dev, id, # 139| (unsigned char *) buf, # 140| size); Error: GCC_ANALYZER_WARNING (CWE-401): [#def11] usbutils-019/usbmisc.c:172:25: warning[-Wanalyzer-malloc-leak]: leak of ‘iconv_open(nl_langinfo(14), "UTF-16LE")’ usbutils-019/usbmisc.c:167:16: acquire_memory: allocated here usbutils-019/usbmisc.c:169:12: branch_false: following ‘false’ branch... usbutils-019/usbmisc.c:172:25: branch_false: ...to here usbutils-019/usbmisc.c:176:25: throw: if ‘iconv’ throws an exception... usbutils-019/usbmisc.c:172:25: danger: ‘iconv_open(nl_langinfo(14), "UTF-16LE")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0) # 170| return NULL; # 171| # 172|-> in_bytes_left = len * 2; # 173| out_bytes_left = len * MB_CUR_MAX; # 174| result = result_end = malloc(out_bytes_left + 1); Error: GCC_ANALYZER_WARNING (CWE-401): [#def12] usbutils-019/usbmisc.c:176:25: warning[-Wanalyzer-malloc-leak]: leak of ‘result_end’ usbutils-019/usbmisc.c:169:12: branch_false: following ‘false’ branch... usbutils-019/usbmisc.c:172:25: branch_false: ...to here usbutils-019/usbmisc.c:174:31: acquire_memory: allocated here usbutils-019/usbmisc.c:176:25: throw: if ‘iconv’ throws an exception... usbutils-019/usbmisc.c:176:25: danger: ‘result_end’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2) # 174| result = result_end = malloc(out_bytes_left + 1); # 175| # 176|-> num_converted = iconv(conv, &str, &in_bytes_left, # 177| &result_end, &out_bytes_left); # 178| Error: GCC_ANALYZER_WARNING (CWE-775): [#def13] usbutils-019/usbreset.c:43:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&path, 0)’ usbutils-019/usbreset.c:181:5: enter_function: entry to ‘main’ usbutils-019/usbreset.c:186:12: branch_true: following ‘true’ branch... usbutils-019/usbreset.c:187:23: call_function: calling ‘find_device’ from ‘main’ # 41| if (fd >= 0) { # 42| len = read(fd, buf, sizeof(buf) - 1); # 43|-> close(fd); # 44| } # 45| Error: GCC_ANALYZER_WARNING (CWE-401): [#def14] usbutils-019/usbreset.c:59:21: warning[-Wanalyzer-malloc-leak]: leak of ‘opendir("/sys/bus/usb/devices")’ usbutils-019/usbreset.c:181:5: enter_function: entry to ‘main’ usbutils-019/usbreset.c:186:12: branch_true: following ‘true’ branch... usbutils-019/usbreset.c:187:23: call_function: calling ‘find_device’ from ‘main’ # 57| # 58| do { # 59|-> e = readdir(d); # 60| # 61| if (!e)
| analyzer-version-clippy | 1.92.0 |
| analyzer-version-cppcheck | 2.19.1 |
| analyzer-version-gcc | 16.0.0 |
| analyzer-version-gcc-analyzer | 16.0.0 |
| analyzer-version-shellcheck | 0.11.0 |
| analyzer-version-unicontrol | 0.0.2 |
| enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol |
| exit-code | 0 |
| host | ip-172-16-1-8.us-west-2.compute.internal |
| known-false-positives | /usr/share/csmock/known-false-positives.js |
| known-false-positives-rpm | known-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch |
| mock-config | fedora-rawhide-x86_64 |
| project-name | usbutils-019-1.fc44 |
| store-results-to | /tmp/tmpk8ly5h9k/usbutils-019-1.fc44.tar.xz |
| time-created | 2026-01-08 22:02:52 |
| time-finished | 2026-01-08 22:04:04 |
| tool | csmock |
| tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpk8ly5h9k/usbutils-019-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpk8ly5h9k/usbutils-019-1.fc44.src.rpm' |
| tool-version | csmock-3.8.3.20251215.161544.g62de9a5-1.el9 |