Newly introduced findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
libguestfs-1.58.0/common/options/keys.c:220:35: warning[-Wanalyzer-malloc-leak]: leak of 'key.<Ufdc0>.string.s'
libguestfs-1.58.0/common/options/keys.c:218:1: enter_function: entry to 'key_store_add_from_selector'
libguestfs-1.58.0/common/options/keys.c:225:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:227:17: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:230:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:232:12: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:233:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:237:6: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:237:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:240:7: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:242:8: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:246:34: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:246:20: acquire_memory: allocated here
libguestfs-1.58.0/common/options/keys.c:247:8: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:265:10: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:265:10: call_function: calling 'key_store_import_key' from 'key_store_add_from_selector'
libguestfs-1.58.0/common/options/keys.c:265:10: return_function: returning to 'key_store_add_from_selector' from 'key_store_import_key'
libguestfs-1.58.0/common/options/keys.c:220:35: throw: if 'guestfs_int_cleanup_free_string_list' throws an exception...
libguestfs-1.58.0/common/options/keys.c:220:35: danger: 'key.<Ufdc0>.string.s' leaks here; was allocated at [(12)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/11)
#  218|   key_store_add_from_selector (struct key_store *ks, const char *selector)
#  219|   {
#  220|->   CLEANUP_FREE_STRING_LIST char **fields = NULL;
#  221|     size_t field_count;
#  222|     struct key_store_key key;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libguestfs-1.58.0/common/options/keys.c:266:1: warning[-Wanalyzer-malloc-leak]: leak of 'key.<Ufdc0>.string.s'
libguestfs-1.58.0/common/options/keys.c:218:1: enter_function: entry to 'key_store_add_from_selector'
libguestfs-1.58.0/common/options/keys.c:225:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:227:17: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:230:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:232:12: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:233:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:237:6: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:237:6: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:240:7: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:242:8: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:246:34: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:246:20: acquire_memory: allocated here
libguestfs-1.58.0/common/options/keys.c:247:8: branch_false: following 'false' branch...
libguestfs-1.58.0/common/options/keys.c:265:10: branch_false: ...to here
libguestfs-1.58.0/common/options/keys.c:265:10: call_function: calling 'key_store_import_key' from 'key_store_add_from_selector'
libguestfs-1.58.0/common/options/keys.c:265:10: return_function: returning to 'key_store_add_from_selector' from 'key_store_import_key'
libguestfs-1.58.0/common/options/keys.c:266:1: danger: 'key.<Ufdc0>.string.s' leaks here; was allocated at [(12)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/11)
#  264|   
#  265|     return key_store_import_key (ks, &key);
#  266|-> }
#  267|   
#  268|   /* Turn /dev/mapper/VG-LV into /dev/VG/LV, in-place. */

Error: CPPCHECK_WARNING (CWE-401): [#def3]
libguestfs-1.58.0/daemon/caml-stubs.c:294: error[memleak]: Memory leak: ret
#  292|     v = Field (retv, 13);
#  293|     ret->app2_class = strdup (String_val (v));
#  294|->   if (ret->app2_class == NULL) return NULL;
#  295|     v = Field (retv, 14);
#  296|     ret->app2_spare2 = strdup (String_val (v));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
libguestfs-1.58.0/daemon/checksum.c:112:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd’
libguestfs-1.58.0/daemon/checksum.c:110:1: enter_function: entry to ‘do_checksum_device’
libguestfs-1.58.0/daemon/checksum.c:114:8: acquire_resource: opened here
libguestfs-1.58.0/daemon/checksum.c:115:6: branch_false: following ‘false’ branch...
libguestfs-1.58.0/daemon/checksum.c:120:10: branch_false: ...to here
libguestfs-1.58.0/daemon/checksum.c:120:10: call_function: calling ‘checksum’ from ‘do_checksum_device’
libguestfs-1.58.0/daemon/checksum.c:112:21: throw: if ‘guestfs_int_cleanup_close’ throws an exception...
libguestfs-1.58.0/daemon/checksum.c:112:21: danger: ‘fd’ leaks here; was opened at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  110|   do_checksum_device (const char *csumtype, const char *device)
#  111|   {
#  112|->   CLEANUP_CLOSE int fd = -1;
#  113|   
#  114|     fd = open (device, O_RDONLY|O_CLOEXEC);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libguestfs-1.58.0/daemon/device-name-translation.c:302:22: warning[-Wanalyzer-malloc-leak]: leak of ‘device_name’
libguestfs-1.58.0/daemon/device-name-translation.c:298:1: enter_function: entry to ‘reverse_btrfsvol’
libguestfs-1.58.0/daemon/device-name-translation.c:308:17: acquire_memory: allocated here
libguestfs-1.58.0/daemon/device-name-translation.c:309:6: branch_false: following ‘false’ branch...
libguestfs-1.58.0/daemon/device-name-translation.c:314:21: branch_false: ...to here
libguestfs-1.58.0/daemon/device-name-translation.c:314:21: call_function: calling ‘reverse_device_name_translation’ from ‘reverse_btrfsvol’
libguestfs-1.58.0/daemon/device-name-translation.c:303:22: throw: if ‘guestfs_int_cleanup_free’ throws an exception...
libguestfs-1.58.0/daemon/device-name-translation.c:302:22: throw: if ‘guestfs_int_cleanup_free’ throws an exception...
libguestfs-1.58.0/daemon/device-name-translation.c:302:22: danger: ‘device_name’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  300|     const char prefix[] = "btrfsvol:";
#  301|     const char *device_start, *device_end;
#  302|->   CLEANUP_FREE char *device_name = NULL;
#  303|     CLEANUP_FREE char *reversed_device = NULL;
#  304|     char *ret;

Error: GCC_ANALYZER_WARNING (CWE-404): [#def6]
libguestfs-1.58.0/lib/actions-variants.c:4453:3: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
libguestfs-1.58.0/lib/actions-variants.c:4433:1: enter_function: entry to 'guestfs_xfs_repair'
libguestfs-1.58.0/lib/actions-variants.c:4441:3: acquire_resource: 'va_start' called here
libguestfs-1.58.0/lib/actions-variants.c:4442:7: call_function: calling 'guestfs_xfs_repair_va' from 'guestfs_xfs_repair'
# 4451|                          va_list args)
# 4452|   {
# 4453|->   ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&g->lock);
# 4454|     struct guestfs_xfs_repair_argv optargs_s;
# 4455|     struct guestfs_xfs_repair_argv *optargs = &optargs_s;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def7]
libguestfs-1.58.0/lib/inspect-apps.c:208:10: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")'
libguestfs-1.58.0/lib/inspect-apps.c:198:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:201:8: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:201:8: acquire_resource: opened here
libguestfs-1.58.0/lib/inspect-apps.c:202:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:208:10: throw: if 'guestfs_int_safe_malloc' throws an exception...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: danger: 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")' leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  206|   
#  207|     /* Allocate 'apps' list. */
#  208|->   apps = safe_malloc (g, sizeof *apps);
#  209|     apps->len = 0;
#  210|     apps->val = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libguestfs-1.58.0/lib/inspect-apps.c:208:10: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")'
libguestfs-1.58.0/lib/inspect-apps.c:198:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:201:8: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:201:8: acquire_memory: allocated here
libguestfs-1.58.0/lib/inspect-apps.c:202:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:208:10: throw: if 'guestfs_int_safe_malloc' throws an exception...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: danger: 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  206|   
#  207|     /* Allocate 'apps' list. */
#  208|->   apps = safe_malloc (g, sizeof *apps);
#  209|     apps->len = 0;
#  210|     apps->val = NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def9]
libguestfs-1.58.0/lib/inspect-apps.c:225:9: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")'
libguestfs-1.58.0/lib/inspect-apps.c:198:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:201:8: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:201:8: acquire_resource: opened here
libguestfs-1.58.0/lib/inspect-apps.c:202:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:215:10: branch_true: following 'true' branch...
libguestfs-1.58.0/lib/inspect-apps.c:216:11: branch_true: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:225:9: branch_false: following 'false' branch (when 'continuation_field' is NULL)...
libguestfs-1.58.0/lib/inspect-apps.c:251:9: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:251:8: branch_true: following 'true' branch...
libguestfs-1.58.0/lib/inspect-apps.c:252:7: branch_true: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:253:14: throw: if 'guestfs_int_safe_strdup' throws an exception...
libguestfs-1.58.0/lib/inspect-apps.c:225:9: danger: 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")' leaks here; was opened at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  223|        * checking for other headers.
#  224|        */
#  225|->     if (line[0] == ' ' && continuation_field) {
#  226|         /* This is a continuation line, and this is the first line of
#  227|          * the field.

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
libguestfs-1.58.0/lib/inspect-apps.c:225:9: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")'
libguestfs-1.58.0/lib/inspect-apps.c:198:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:201:8: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:201:8: acquire_memory: allocated here
libguestfs-1.58.0/lib/inspect-apps.c:202:6: branch_false: following 'false' branch...
libguestfs-1.58.0/lib/inspect-apps.c:208:10: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:215:10: branch_true: following 'true' branch...
libguestfs-1.58.0/lib/inspect-apps.c:216:11: branch_true: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:225:9: branch_false: following 'false' branch (when 'continuation_field' is NULL)...
libguestfs-1.58.0/lib/inspect-apps.c:251:9: branch_false: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:251:8: branch_true: following 'true' branch...
libguestfs-1.58.0/lib/inspect-apps.c:252:7: branch_true: ...to here
libguestfs-1.58.0/lib/inspect-apps.c:253:14: throw: if 'guestfs_int_safe_strdup' throws an exception...
libguestfs-1.58.0/lib/inspect-apps.c:225:9: danger: 'fopen(guestfs_int_download_to_tmp(g, "/var/lib/dpkg/status", 0, 50000000), "r")' leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  223|        * checking for other headers.
#  224|        */
#  225|->     if (line[0] == ' ' && continuation_field) {
#  226|         /* This is a continuation line, and this is the first line of
#  227|          * the field.

Error: CLIPPY_WARNING: [#def11]
src/guestfs.rs:16135:59: warning: this expression borrows a value the compiler would automatically borrow
#        |
#  16135 | ...   let r = unsafe { guestfs_umount_opts_argv(self.g, (&c_pathordevice).as_ptr(), &(RawUmountOptArgs::from(&optargs_cexpr)) as *const R...
#        |                                                         ^^^^^^^^^^^^^^^^^ help: change this to: `c_pathordevice`
#        |
#        = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrow

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.92.0
diffbase-analyzer-version-cppcheck2.19.1
diffbase-analyzer-version-gcc16.0.0
diffbase-analyzer-version-gcc-analyzer16.0.0
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-23.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namelibguestfs-1.57.2-2.fc43
diffbase-store-results-to/tmp/tmpbhucue2k/libguestfs-1.57.2-2.fc43.tar.xz
diffbase-time-created2026-01-08 18:52:22
diffbase-time-finished2026-01-08 19:04:58
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpbhucue2k/libguestfs-1.57.2-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpbhucue2k/libguestfs-1.57.2-2.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-23.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namelibguestfs-1.58.0-1.fc44
store-results-to/tmp/tmpsr5sqsne/libguestfs-1.58.0-1.fc44.tar.xz
time-created2026-01-08 19:05:44
time-finished2026-01-08 19:17:28
titleNewly introduced findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpsr5sqsne/libguestfs-1.58.0-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpsr5sqsne/libguestfs-1.58.0-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9