guestfs-tools-1.53.9-1.fc43

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
guestfs-tools-1.53.9/builder/index-parse.c:1231:11: warning[-Wanalyzer-malloc-leak]: leak of ‘yyptr’
guestfs-tools-1.53.9/builder/index-parse.y:174:1: enter_function: entry to ‘do_parse’
guestfs-tools-1.53.9/builder/index-parse.y:180:9: call_function: calling ‘yyparse’ from ‘do_parse’
# 1229|           yy_state_t *yyss1 = yyss;
# 1230|           union yyalloc *yyptr =
# 1231|->           YY_CAST (union yyalloc *,
# 1232|                      YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
# 1233|           if (! yyptr)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def2]
guestfs-tools-1.53.9/builder/index-parse.c:1235:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘yyss’
guestfs-tools-1.53.9/builder/index-parse.y:174:1: enter_function: entry to ‘do_parse’
guestfs-tools-1.53.9/builder/index-parse.y:180:9: call_function: calling ‘yyparse’ from ‘do_parse’
# 1233|           if (! yyptr)
# 1234|             YYNOMEM;
# 1235|->         YYSTACK_RELOCATE (yyss_alloc, yyss);
# 1236|           YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# 1237|           YYSTACK_RELOCATE (yyls_alloc, yyls);

Error: CPPCHECK_WARNING (CWE-476): [#def3]
guestfs-tools-1.53.9/builder/index-parse.y:59: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#   57|     len = len1 + 1 /* \n */ + len2 + 1 /* \0 */;
#   58|     ret = malloc (len);
#   59|->   memcpy (ret, str1, len1);
#   60|     ret[len1] = '\n';
#   61|     memcpy (ret + len1 + 1, str2, len2);

Error: CPPCHECK_WARNING (CWE-476): [#def4]
guestfs-tools-1.53.9/builder/index-parse.y:60: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#   58|     ret = malloc (len);
#   59|     memcpy (ret, str1, len1);
#   60|->   ret[len1] = '\n';
#   61|     memcpy (ret + len1 + 1, str2, len2);
#   62|     ret[len-1] = '\0';

Error: CPPCHECK_WARNING (CWE-682): [#def5]
guestfs-tools-1.53.9/builder/index-parse.y:61: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
#   59|     memcpy (ret, str1, len1);
#   60|     ret[len1] = '\n';
#   61|->   memcpy (ret + len1 + 1, str2, len2);
#   62|     ret[len-1] = '\0';
#   63|   

Error: CPPCHECK_WARNING (CWE-476): [#def6]
guestfs-tools-1.53.9/builder/index-parse.y:62: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#   60|     ret[len1] = '\n';
#   61|     memcpy (ret + len1 + 1, str2, len2);
#   62|->   ret[len-1] = '\0';
#   63|   
#   64|     return ret;

Error: CPPCHECK_WARNING (CWE-476): [#def7]
guestfs-tools-1.53.9/builder/index-parse.y:124: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: yyval.section
#  122|         SECTION_HEADER fields
#  123|           { $$ = malloc (sizeof (struct section));
#  124|->           $$->next = NULL;
#  125|             $$->name = $1;
#  126|             $$->fields = $2; }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
guestfs-tools-1.53.9/builder/index-parse.y:124:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(24)’
guestfs-tools-1.53.9/builder/index-parse.y:174:1: enter_function: entry to ‘do_parse’
guestfs-tools-1.53.9/builder/index-parse.y:180:9: call_function: calling ‘yyparse’ from ‘do_parse’
#  122|         SECTION_HEADER fields
#  123|           { $$ = malloc (sizeof (struct section));
#  124|->           $$->next = NULL;
#  125|             $$->name = $1;
#  126|             $$->fields = $2; }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
guestfs-tools-1.53.9/builder/index-scan.c:1550:12: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(64)’
guestfs-tools-1.53.9/builder/index-scan.c:1536:21: enter_function: entry to ‘yy_create_buffer’
guestfs-tools-1.53.9/builder/index-scan.c:1540:24: call_function: inlined call to ‘yyalloc’ from ‘yy_create_buffer’
guestfs-tools-1.53.9/builder/index-scan.c:1541:12: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/builder/index-scan.c:1544:2: branch_false: ...to here
guestfs-tools-1.53.9/builder/index-scan.c:1550:12: danger: ‘malloc(64)’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
# 1548|   	 * we need to put in 2 end-of-buffer characters.
# 1549|   	 */
# 1550|-> 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
# 1551|   	if ( ! b->yy_ch_buf )
# 1552|   		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
guestfs-tools-1.53.9/builder/index-scan.c:1592:2: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘b’
guestfs-tools-1.53.9/builder/index-scan.c:1387:16: enter_function: entry to ‘input’
guestfs-tools-1.53.9/builder/index-scan.c:1396:5: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/builder/index-scan.c:1402:41: branch_true: ...to here
guestfs-tools-1.53.9/builder/index-scan.c:1402:20: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/builder/index-scan.c:1408:63: branch_false: ...to here
guestfs-tools-1.53.9/builder/index-scan.c:1411:13: call_function: calling ‘yy_get_next_buffer’ from ‘input’
guestfs-tools-1.53.9/builder/index-scan.c:1411:13: return_function: returning to ‘input’ from ‘yy_get_next_buffer’
guestfs-tools-1.53.9/builder/index-scan.c:1425:41: call_function: calling ‘yyrestart’ from ‘input’
# 1590|   
# 1591|   	yy_flush_buffer( b , yyscanner);
# 1592|-> 
# 1593|   	b->yy_input_file = file;
# 1594|   	b->yy_fill_buffer = 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
guestfs-tools-1.53.9/builder/index-scan.c:1810:26: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc(n)’
guestfs-tools-1.53.9/builder/index-scan.c:1794:17: enter_function: entry to ‘yy_scan_bytes’
guestfs-tools-1.53.9/builder/index-scan.c:1803:24: call_function: inlined call to ‘yyalloc’ from ‘yy_scan_bytes’
guestfs-tools-1.53.9/builder/index-scan.c:1804:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/builder/index-scan.c:1812:6: call_function: calling ‘yy_scan_buffer’ from ‘yy_scan_bytes’
# 1808|   	for ( i = 0; i < _yybytes_len; ++i )
# 1809|   		buf[i] = yybytes[i];
# 1810|-> 
# 1811|   	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
# 1812|   

Error: CPPCHECK_WARNING (CWE-476): [#def12]
guestfs-tools-1.53.9/builder/index-validate.c:116: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: in
#  114|     ret = do_parse (&context, in);
#  115|   
#  116|->   if (fclose (in) == EOF) {
#  117|       fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
#  118|                getprogname (), input);

Error: CPPCHECK_WARNING (CWE-476): [#def13]
guestfs-tools-1.53.9/cat/cat.c:174: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mp
#  172|   
#  173|       case 'm':
#  174|->       OPTION_m;
#  175|         inspector = 0;
#  176|         break;

Error: CPPCHECK_WARNING (CWE-476): [#def14]
guestfs-tools-1.53.9/cat/cat.c:209: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  207|           if (!drv)
#  208|             error (EXIT_FAILURE, errno, "calloc");
#  209|->         drv->type = drv_a;
#  210|           drv->a.filename = strdup (argv[optind]);
#  211|           if (!drv->a.filename)

Error: CPPCHECK_WARNING (CWE-476): [#def15]
guestfs-tools-1.53.9/cat/cat.c:210: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  208|             error (EXIT_FAILURE, errno, "calloc");
#  209|           drv->type = drv_a;
#  210|->         drv->a.filename = strdup (argv[optind]);
#  211|           if (!drv->a.filename)
#  212|             error (EXIT_FAILURE, errno, "strdup");

Error: CPPCHECK_WARNING (CWE-476): [#def16]
guestfs-tools-1.53.9/cat/cat.c:211: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  209|           drv->type = drv_a;
#  210|           drv->a.filename = strdup (argv[optind]);
#  211|->         if (!drv->a.filename)
#  212|             error (EXIT_FAILURE, errno, "strdup");
#  213|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def17]
guestfs-tools-1.53.9/cat/cat.c:219: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  217|           if (!drv)
#  218|             error (EXIT_FAILURE, errno, "calloc");
#  219|->         drv->type = drv_d;
#  220|           drv->d.guest = argv[optind];
#  221|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def18]
guestfs-tools-1.53.9/cat/cat.c:220: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  218|             error (EXIT_FAILURE, errno, "calloc");
#  219|           drv->type = drv_d;
#  220|->         drv->d.guest = argv[optind];
#  221|           drv->next = drvs;
#  222|           drvs = drv;

Error: CPPCHECK_WARNING (CWE-476): [#def19]
guestfs-tools-1.53.9/cat/cat.c:221: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  219|           drv->type = drv_d;
#  220|           drv->d.guest = argv[optind];
#  221|->         drv->next = drvs;
#  222|           drvs = drv;
#  223|         }

Error: CPPCHECK_WARNING (CWE-476): [#def20]
guestfs-tools-1.53.9/cat/filesystems.c:568: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parent_name
#  566|         if (parent_name == NULL)
#  567|           error (EXIT_FAILURE, errno, "strdup");
#  568|->       char *p = strrchr (parent_name, '/');
#  569|         if (p)
#  570|           *p = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def21]
guestfs-tools-1.53.9/cat/filesystems.c:766: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#  764|       error (EXIT_FAILURE, errno, "malloc");
#  765|   
#  766|->   ret[0] = NULL;
#  767|   
#  768|     return ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
guestfs-tools-1.53.9/cat/filesystems.c:768:10: warning[-Wanalyzer-malloc-leak]: leak of ‘no_parents()’
guestfs-tools-1.53.9/cat/filesystems.c:723:1: enter_function: entry to ‘do_output_blockdevs’
guestfs-tools-1.53.9/cat/filesystems.c:728:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:731:15: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:733:37: branch_true: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:737:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:740:9: branch_false: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:746:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:749:17: branch_false: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:749:17: call_function: calling ‘no_parents’ from ‘do_output_blockdevs’
guestfs-tools-1.53.9/cat/filesystems.c:749:17: return_function: returning to ‘do_output_blockdevs’ from ‘no_parents’
guestfs-tools-1.53.9/cat/filesystems.c:768:10: danger: ‘no_parents()’ leaks here; was allocated at [(12)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/11)
#  766|     ret[0] = NULL;
#  767|   
#  768|->   return ret;
#  769|   }
#  770|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
guestfs-tools-1.53.9/cat/filesystems.c:797:5: warning[-Wanalyzer-malloc-leak]: leak of ‘parents_of_md(*<unknown>)’
guestfs-tools-1.53.9/cat/filesystems.c:723:1: enter_function: entry to ‘do_output_blockdevs’
guestfs-tools-1.53.9/cat/filesystems.c:728:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:731:15: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:733:37: branch_true: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:737:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:740:9: branch_false: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:746:8: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/filesystems.c:747:17: branch_true: ...to here
guestfs-tools-1.53.9/cat/filesystems.c:747:17: call_function: calling ‘parents_of_md’ from ‘do_output_blockdevs’
guestfs-tools-1.53.9/cat/filesystems.c:747:17: return_function: returning to ‘do_output_blockdevs’ from ‘parents_of_md’
guestfs-tools-1.53.9/cat/filesystems.c:797:5: danger: ‘parents_of_md(*<unknown>)’ leaks here; was allocated at [(14)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/13)
#  795|   
#  796|     CLEANUP_FREE_MDSTAT_LIST struct guestfs_mdstat_list *stats =
#  797|->     guestfs_md_stat (g, device);
#  798|     if (!stats)
#  799|       exit (EXIT_FAILURE);

Error: CPPCHECK_WARNING (CWE-476): [#def24]
guestfs-tools-1.53.9/cat/filesystems.c:806: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#  804|   
#  805|     for (i = 0; i < stats->len; ++i) {
#  806|->     ret[i] = guestfs_canonical_device_name (g, stats->val[i].mdstat_device);
#  807|       if (!ret[i])
#  808|         exit (EXIT_FAILURE);

Error: CPPCHECK_WARNING (CWE-476): [#def25]
guestfs-tools-1.53.9/cat/filesystems.c:807: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#  805|     for (i = 0; i < stats->len; ++i) {
#  806|       ret[i] = guestfs_canonical_device_name (g, stats->val[i].mdstat_device);
#  807|->     if (!ret[i])
#  808|         exit (EXIT_FAILURE);
#  809|     }

Error: CPPCHECK_WARNING (CWE-476): [#def26]
guestfs-tools-1.53.9/cat/ls.c:280: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mp
#  278|   
#  279|       case 'm':
#  280|->       OPTION_m;
#  281|         inspector = 0;
#  282|         break;

Error: CPPCHECK_WARNING (CWE-476): [#def27]
guestfs-tools-1.53.9/cat/ls.c:319: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  317|           if (!drv)
#  318|             error (EXIT_FAILURE, errno, "calloc");
#  319|->         drv->type = drv_a;
#  320|           drv->a.filename = strdup (argv[optind]);
#  321|           if (!drv->a.filename)

Error: CPPCHECK_WARNING (CWE-476): [#def28]
guestfs-tools-1.53.9/cat/ls.c:320: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  318|             error (EXIT_FAILURE, errno, "calloc");
#  319|           drv->type = drv_a;
#  320|->         drv->a.filename = strdup (argv[optind]);
#  321|           if (!drv->a.filename)
#  322|             error (EXIT_FAILURE, errno, "strdup");

Error: CPPCHECK_WARNING (CWE-476): [#def29]
guestfs-tools-1.53.9/cat/ls.c:321: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  319|           drv->type = drv_a;
#  320|           drv->a.filename = strdup (argv[optind]);
#  321|->         if (!drv->a.filename)
#  322|             error (EXIT_FAILURE, errno, "strdup");
#  323|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def30]
guestfs-tools-1.53.9/cat/ls.c:329: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  327|           if (!drv)
#  328|             error (EXIT_FAILURE, errno, "calloc");
#  329|->         drv->type = drv_d;
#  330|           drv->d.guest = argv[optind];
#  331|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def31]
guestfs-tools-1.53.9/cat/ls.c:330: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  328|             error (EXIT_FAILURE, errno, "calloc");
#  329|           drv->type = drv_d;
#  330|->         drv->d.guest = argv[optind];
#  331|           drv->next = drvs;
#  332|           drvs = drv;

Error: CPPCHECK_WARNING (CWE-476): [#def32]
guestfs-tools-1.53.9/cat/ls.c:331: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  329|           drv->type = drv_d;
#  330|           drv->d.guest = argv[optind];
#  331|->         drv->next = drvs;
#  332|           drvs = drv;
#  333|         }

Error: CPPCHECK_WARNING (CWE-476): [#def33]
guestfs-tools-1.53.9/cat/tail.c:187: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mp
#  185|   
#  186|       case 'm':
#  187|->       OPTION_m;
#  188|         inspector = 0;
#  189|         break;

Error: CPPCHECK_WARNING (CWE-401): [#def34]
guestfs-tools-1.53.9/cat/tail.c:286: error[memleak]: Memory leak: file
#  284|     drvt = disk_mtime (drvs);
#  285|     if (drvt == (time_t)-1)
#  286|->     return -1;
#  287|   
#  288|     while (!quit) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def35]
guestfs-tools-1.53.9/cat/tail.c:349:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘file’
guestfs-tools-1.53.9/cat/tail.c:262:1: enter_function: entry to ‘do_tail’
guestfs-tools-1.53.9/cat/tail.c:272:10: acquire_memory: this call could return NULL
guestfs-tools-1.53.9/cat/tail.c:281:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:284:10: call_function: inlined call to ‘disk_mtime’ from ‘do_tail’
guestfs-tools-1.53.9/cat/tail.c:285:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:288:10: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/tail.c:293:37: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:302:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:305:8: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:310:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:325:5: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:325:17: branch_true: following ‘true’ branch (when ‘i < argc’)...
guestfs-tools-1.53.9/cat/tail.c:326:26: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:329:10: branch_false: following ‘false’ branch (when ‘windows == 0’)...
guestfs-tools-1.53.9/cat/tail.c:335:32: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:336:12: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:342:7: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:345:10: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/tail.c:347:13: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:347:12: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/tail.c:348:11: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:349:11: danger: ‘file + (long unsigned int)i * 16’ could be NULL: unchecked value from [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#  347|           if (guestfs_last_errno (g) == ENOENT) {
#  348|             time (&t);
#  349|->           file[i].mtime = t;
#  350|             file[i].size = 0;
#  351|           }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def36]
guestfs-tools-1.53.9/cat/tail.c:368:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘file’
guestfs-tools-1.53.9/cat/tail.c:262:1: enter_function: entry to ‘do_tail’
guestfs-tools-1.53.9/cat/tail.c:272:10: acquire_memory: this call could return NULL
guestfs-tools-1.53.9/cat/tail.c:281:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:284:10: call_function: inlined call to ‘disk_mtime’ from ‘do_tail’
guestfs-tools-1.53.9/cat/tail.c:285:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:288:10: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/cat/tail.c:293:37: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:302:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:305:8: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:310:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:325:5: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:325:17: branch_true: following ‘true’ branch (when ‘i < argc’)...
guestfs-tools-1.53.9/cat/tail.c:326:26: branch_true: ...to here
guestfs-tools-1.53.9/cat/tail.c:329:10: branch_false: following ‘false’ branch (when ‘windows == 0’)...
guestfs-tools-1.53.9/cat/tail.c:335:32: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:336:12: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:342:7: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:345:10: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/cat/tail.c:359:41: branch_false: ...to here
guestfs-tools-1.53.9/cat/tail.c:368:13: danger: ‘file + (long unsigned int)i * 16’ could be NULL: unchecked value from [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  366|            * so be careful.
#  367|            */
#  368|->         if (file[i].mtime != stat->st_mtime_sec ||
#  369|               file[i].size != stat->st_size) {
#  370|             /* If we get here, the file changed and we're going to display

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
guestfs-tools-1.53.9/common/edit/file-edit.c:326:6: warning[-Wanalyzer-malloc-leak]: leak of 'generate_random_name(guestfs_realpath(g,  fn))'
guestfs-tools-1.53.9/common/edit/file-edit.c:251:1: enter_function: entry to 'do_upload'
guestfs-tools-1.53.9/common/edit/file-edit.c:266:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/edit/file-edit.c:274:13: branch_false: ...to here
guestfs-tools-1.53.9/common/edit/file-edit.c:274:13: call_function: calling 'generate_random_name' from 'do_upload'
guestfs-tools-1.53.9/common/edit/file-edit.c:274:13: return_function: returning to 'do_upload' from 'generate_random_name'
guestfs-tools-1.53.9/common/edit/file-edit.c:326:6: danger: 'generate_random_name(guestfs_realpath(g,  fn))' leaks here; was allocated at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
#  324|      * trailing \0.
#  325|      */
#  326|->   if (guestfs_int_random_string (p, 8) == -1) {
#  327|       perror ("guestfs_int_random_string");
#  328|       free (ret);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:326:6: warning[-Wanalyzer-malloc-leak]: leak of ‘generate_random_name(guestfs_realpath(g,  fn))’
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:251:1: enter_function: entry to ‘do_upload’
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:266:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:274:13: branch_false: ...to here
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:274:13: call_function: calling ‘generate_random_name’ from ‘do_upload’
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:274:13: return_function: returning to ‘do_upload’ from ‘generate_random_name’
guestfs-tools-1.53.9/common/mlcustomize/../edit/file-edit.c:326:6: danger: ‘generate_random_name(guestfs_realpath(g,  fn))’ leaks here; was allocated at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
#  324|      * trailing \0.
#  325|      */
#  326|->   if (guestfs_int_random_string (p, 8) == -1) {
#  327|       perror ("guestfs_int_random_string");
#  328|       free (ret);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def39]
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:247:3: warning[-Wanalyzer-malloc-leak]: leak of ‘m’
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:190:1: enter_function: entry to ‘guestfs_int_pcre_matches’
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:192:3: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:192:3: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:198:7: acquire_memory: allocated here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:199:6: branch_false: following ‘false’ branch (when ‘m’ is non-NULL)...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:205:16: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:206:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:210:3: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:214:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:220:23: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:222:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:232:3: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:232:3: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:239:6: branch_true: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:239:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:240:12: branch_true: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:241:5: call_function: inlined call to ‘free_last_match’ from ‘guestfs_int_pcre_matches’
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:242:5: branch_false: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:247:3: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:247:3: branch_true: ...to here
guestfs-tools-1.53.9/common/mlpcre/pcre-c.c:247:3: danger: ‘m’ leaks here; was allocated at [(4)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/3)
#  245|       free_last_match (m);
#  246|   
#  247|->   CAMLreturn (r ? Val_true : Val_false);
#  248|   }
#  249|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def40]
guestfs-tools-1.53.9/common/mltools/../options/decrypt.c:96:27: warning[-Wanalyzer-malloc-leak]: leak of ‘make_mapname(mountable)’
guestfs-tools-1.53.9/common/mltools/../options/decrypt.c:201:1: enter_function: entry to ‘inspect_do_decrypt’
guestfs-tools-1.53.9/common/mltools/../options/decrypt.c:207:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/decrypt.c:210:17: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/decrypt.c:210:17: call_function: calling ‘decrypt_mountables’ from ‘inspect_do_decrypt’
#   94|   
#   95|       /* filter & copy */
#   96|->     while ((ichar = device[ipos]) != '\0') {
#   97|         if (c_isalnum (ichar))
#   98|           append_char (&opos, mapname, ichar);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def41]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:99:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘infp’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:130:1: enter_function: entry to ‘get_keys’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:148:6: branch_false: following ‘false’ branch (when ‘r’ is non-NULL)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:188:6: branch_true: following ‘true’ branch (when ‘match == r’)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:190:9: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:190:9: call_function: calling ‘read_key’ from ‘get_keys’
#   97|       fclose (infp); /* outfp == infp, so this is closed also */
#   98|   
#   99|->   return ret;
#  100|   }
#  101|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def42]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:99:10: warning[-Wanalyzer-malloc-leak]: leak of ‘infp’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:130:1: enter_function: entry to ‘get_keys’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:148:6: branch_false: following ‘false’ branch (when ‘r’ is non-NULL)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:188:6: branch_true: following ‘true’ branch (when ‘match == r’)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:190:9: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:190:9: call_function: calling ‘read_key’ from ‘get_keys’
#   97|       fclose (infp); /* outfp == infp, so this is closed also */
#   98|   
#   99|->   return ret;
#  100|   }
#  101|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def43]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:110:8: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "r")’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:130:1: enter_function: entry to ‘get_keys’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:148:6: branch_false: following ‘false’ branch (when ‘r’ is non-NULL)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_true: following ‘true’ branch (when ‘ks’ is non-NULL)...
 branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:154:17: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:155:36: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:174:13: call_function: calling ‘read_first_line_from_file’ from ‘get_keys’
#  108|     ssize_t len;
#  109|   
#  110|->   fp = fopen (filename, "r");
#  111|     if (!fp)
#  112|       error (EXIT_FAILURE, errno, "fopen: %s", filename);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def44]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:110:8: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "r")’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:130:1: enter_function: entry to ‘get_keys’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:148:6: branch_false: following ‘false’ branch (when ‘r’ is non-NULL)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:153:6: branch_true: following ‘true’ branch (when ‘ks’ is non-NULL)...
 branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:154:17: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:155:36: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:174:13: call_function: calling ‘read_first_line_from_file’ from ‘get_keys’
#  108|     ssize_t len;
#  109|   
#  110|->   fp = fopen (filename, "r");
#  111|     if (!fp)
#  112|       error (EXIT_FAILURE, errno, "fopen: %s", filename);

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

Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:380:24: warning[-Wanalyzer-malloc-leak]: leak of ‘key_store_import_key(ks, & key)’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:218:1: enter_function: entry to ‘key_store_add_from_selector’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:225:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:227:17: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:230:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:232:12: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:233:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:237:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:237:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:240:7: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:240:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:249:14: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:249:13: branch_false: following ‘false’ branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:258:14: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:258:13: branch_true: following ‘true’ branch (when the strings are equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:259:5: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:260:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: call_function: calling ‘key_store_import_key’ from ‘key_store_add_from_selector’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: return_function: returning to ‘key_store_add_from_selector’ from ‘key_store_import_key’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:380:24: danger: ‘key_store_import_key(ks, & key)’ leaks here; was allocated at [(22)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/21)
#  378|   
#  379|     new_keys = realloc (ks->keys,
#  380|->                       (ks->nr_keys + 1) * sizeof (struct key_store_key));
#  381|     if (!new_keys)
#  382|       error (EXIT_FAILURE, errno, "realloc");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
guestfs-tools-1.53.9/common/mltools/../options/keys.c:389:10: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:218:1: enter_function: entry to ‘key_store_add_from_selector’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:225:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:227:17: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:230:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:232:12: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:233:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:237:6: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:237:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:240:7: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:240:6: branch_false: following ‘false’ branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:249:14: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:249:13: branch_false: following ‘false’ branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:258:14: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:258:13: branch_true: following ‘true’ branch (when the strings are equal)...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:259:5: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:260:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: call_function: calling ‘key_store_import_key’ from ‘key_store_add_from_selector’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:265:10: return_function: returning to ‘key_store_add_from_selector’ from ‘key_store_import_key’
guestfs-tools-1.53.9/common/mltools/../options/keys.c:389:10: danger: ‘<unknown>’ leaks here; was allocated at [(24)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/23)
#  387|     ++ks->nr_keys;
#  388|   
#  389|->   return ks;
#  390|   }
#  391|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
guestfs-tools-1.53.9/common/mltools/../options/uri.c:228:17: warning[-Wanalyzer-malloc-leak]: leak of ‘query_get(xmlParseURI(arg), "socket")’
guestfs-tools-1.53.9/common/mltools/../options/uri.c:110:1: enter_function: entry to ‘parse’
guestfs-tools-1.53.9/common/mltools/../options/uri.c:118:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/uri.c:128:7: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/../options/uri.c:128:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/../options/uri.c:135:12: call_function: calling ‘query_get’ from ‘parse’
guestfs-tools-1.53.9/common/mltools/../options/uri.c:135:12: return_function: returning to ‘parse’ from ‘query_get’
guestfs-tools-1.53.9/common/mltools/../options/uri.c:228:17: danger: ‘query_get(xmlParseURI(arg), "socket")’ leaks here; was allocated at [(24)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/23)
#  226|     const char *end, *eq;
#  227|   
#  228|->   if (!query || STREQ (query, ""))
#  229|       return NULL;
#  230|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
guestfs-tools-1.53.9/common/mltools/getopt-c.c:57:10: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘p’
guestfs-tools-1.53.9/common/mltools/getopt-c.c:205:1: enter_function: entry to ‘guestfs_int_mllib_getopt_parse’
guestfs-tools-1.53.9/common/mltools/getopt-c.c:207:3: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/getopt-c.c:207:3: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:214:43: release_memory: ‘longopts’ is NULL
guestfs-tools-1.53.9/common/mltools/getopt-c.c:221:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/common/mltools/getopt-c.c:222:5: branch_true: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:214:43: call_function: calling ‘cleanup_option_list’ from ‘guestfs_int_mllib_getopt_parse’
#   55|     struct option *p = opts;
#   56|   
#   57|->   while (p->name != NULL) {
#   58|       /* Cast the constness away, since we created the names on heap. */
#   59|       free ((char *) p->name);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def51]
guestfs-tools-1.53.9/common/mltools/getopt-c.c:338:13: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘specv_index’
guestfs-tools-1.53.9/common/mltools/getopt-c.c:207:3: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/getopt-c.c:207:3: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:221:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:233:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/common/mltools/getopt-c.c:235:14: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:236:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:322:8: branch_false: following ‘false’ branch (when ‘c != -1’)...
guestfs-tools-1.53.9/common/mltools/getopt-c.c:324:5: branch_false: ...to here
guestfs-tools-1.53.9/common/mltools/getopt-c.c:338:13: danger: use of uninitialized value ‘specv_index’ here
#  336|       }
#  337|   
#  338|->     specv = Field (specsv, specv_index);
#  339|       actionv = Field (specv, 1);
#  340|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
guestfs-tools-1.53.9/common/options/decrypt.c:96:27: warning[-Wanalyzer-malloc-leak]: leak of 'make_mapname(mountable)'
guestfs-tools-1.53.9/common/options/decrypt.c:201:1: enter_function: entry to 'inspect_do_decrypt'
guestfs-tools-1.53.9/common/options/decrypt.c:207:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/decrypt.c:210:17: branch_false: ...to here
guestfs-tools-1.53.9/common/options/decrypt.c:210:17: call_function: calling 'decrypt_mountables' from 'inspect_do_decrypt'
#   94|   
#   95|       /* filter & copy */
#   96|->     while ((ichar = device[ipos]) != '\0') {
#   97|         if (c_isalnum (ichar))
#   98|           append_char (&opos, mapname, ichar);

Error: CPPCHECK_WARNING (CWE-476): [#def53]
guestfs-tools-1.53.9/common/options/decrypt.c:113: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mapname
#  111|   
#  112|         /* populate the output prefix -- note: not NUL-terminated yet */
#  113|->       memcpy (mapname, oprefix, oprefixlen);
#  114|       }
#  115|     }

Error: CPPCHECK_WARNING (CWE-457): [#def54]
guestfs-tools-1.53.9/common/options/decrypt.c:178: warning[uninitvar]: Uninitialized variable: r
#  176|         guestfs_pop_error_handler (g);
#  177|   
#  178|->       if (r == 0)
#  179|           break;
#  180|       }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def55]
guestfs-tools-1.53.9/common/options/keys.c:99:10: warning[-Wanalyzer-file-leak]: leak of FILE 'infp'
guestfs-tools-1.53.9/common/options/keys.c:130:1: enter_function: entry to 'get_keys'
guestfs-tools-1.53.9/common/options/keys.c:148:6: branch_false: following 'false' branch (when 'r' is non-NULL)...
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:188:6: branch_true: following 'true' branch (when 'match == r')...
guestfs-tools-1.53.9/common/options/keys.c:190:9: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:190:9: call_function: calling 'read_key' from 'get_keys'
#   97|       fclose (infp); /* outfp == infp, so this is closed also */
#   98|   
#   99|->   return ret;
#  100|   }
#  101|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
guestfs-tools-1.53.9/common/options/keys.c:99:10: warning[-Wanalyzer-malloc-leak]: leak of 'infp'
guestfs-tools-1.53.9/common/options/keys.c:130:1: enter_function: entry to 'get_keys'
guestfs-tools-1.53.9/common/options/keys.c:148:6: branch_false: following 'false' branch (when 'r' is non-NULL)...
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:188:6: branch_true: following 'true' branch (when 'match == r')...
guestfs-tools-1.53.9/common/options/keys.c:190:9: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:190:9: call_function: calling 'read_key' from 'get_keys'
#   97|       fclose (infp); /* outfp == infp, so this is closed also */
#   98|   
#   99|->   return ret;
#  100|   }
#  101|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def57]
guestfs-tools-1.53.9/common/options/keys.c:110:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "r")'
guestfs-tools-1.53.9/common/options/keys.c:130:1: enter_function: entry to 'get_keys'
guestfs-tools-1.53.9/common/options/keys.c:148:6: branch_false: following 'false' branch (when 'r' is non-NULL)...
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_true: following 'true' branch (when 'ks' is non-NULL)...
 branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:154:17: branch_true: following 'true' branch...
guestfs-tools-1.53.9/common/options/keys.c:155:36: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:174:13: call_function: calling 'read_first_line_from_file' from 'get_keys'
#  108|     ssize_t len;
#  109|   
#  110|->   fp = fopen (filename, "r");
#  111|     if (!fp)
#  112|       error (EXIT_FAILURE, errno, "fopen: %s", filename);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def58]
guestfs-tools-1.53.9/common/options/keys.c:110:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "r")'
guestfs-tools-1.53.9/common/options/keys.c:130:1: enter_function: entry to 'get_keys'
guestfs-tools-1.53.9/common/options/keys.c:148:6: branch_false: following 'false' branch (when 'r' is non-NULL)...
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:153:6: branch_true: following 'true' branch (when 'ks' is non-NULL)...
 branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:154:17: branch_true: following 'true' branch...
guestfs-tools-1.53.9/common/options/keys.c:155:36: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:174:13: call_function: calling 'read_first_line_from_file' from 'get_keys'
#  108|     ssize_t len;
#  109|   
#  110|->   fp = fopen (filename, "r");
#  111|     if (!fp)
#  112|       error (EXIT_FAILURE, errno, "fopen: %s", filename);

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

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
guestfs-tools-1.53.9/common/options/keys.c:380:24: warning[-Wanalyzer-malloc-leak]: leak of 'key_store_import_key(ks, & key)'
guestfs-tools-1.53.9/common/options/keys.c:218:1: enter_function: entry to 'key_store_add_from_selector'
guestfs-tools-1.53.9/common/options/keys.c:225:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:227:17: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:230:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:232:12: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:233:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:237:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:237:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:240:7: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:240:6: branch_false: following 'false' branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/options/keys.c:249:14: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:249:13: branch_false: following 'false' branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/options/keys.c:258:14: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:258:13: branch_true: following 'true' branch (when the strings are equal)...
guestfs-tools-1.53.9/common/options/keys.c:259:5: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:260:8: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:265:10: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:265:10: call_function: calling 'key_store_import_key' from 'key_store_add_from_selector'
guestfs-tools-1.53.9/common/options/keys.c:265:10: return_function: returning to 'key_store_add_from_selector' from 'key_store_import_key'
guestfs-tools-1.53.9/common/options/keys.c:380:24: danger: 'key_store_import_key(ks, & key)' leaks here; was allocated at [(22)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/21)
#  378|   
#  379|     new_keys = realloc (ks->keys,
#  380|->                       (ks->nr_keys + 1) * sizeof (struct key_store_key));
#  381|     if (!new_keys)
#  382|       error (EXIT_FAILURE, errno, "realloc");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
guestfs-tools-1.53.9/common/options/keys.c:389:10: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
guestfs-tools-1.53.9/common/options/keys.c:218:1: enter_function: entry to 'key_store_add_from_selector'
guestfs-tools-1.53.9/common/options/keys.c:225:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:227:17: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:230:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:232:12: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:233:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:237:6: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:237:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:240:7: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:240:6: branch_false: following 'false' branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/options/keys.c:249:14: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:249:13: branch_false: following 'false' branch (when the strings are non-equal)...
guestfs-tools-1.53.9/common/options/keys.c:258:14: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:258:13: branch_true: following 'true' branch (when the strings are equal)...
guestfs-tools-1.53.9/common/options/keys.c:259:5: branch_true: ...to here
guestfs-tools-1.53.9/common/options/keys.c:260:8: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/keys.c:265:10: branch_false: ...to here
guestfs-tools-1.53.9/common/options/keys.c:265:10: call_function: calling 'key_store_import_key' from 'key_store_add_from_selector'
guestfs-tools-1.53.9/common/options/keys.c:265:10: return_function: returning to 'key_store_add_from_selector' from 'key_store_import_key'
guestfs-tools-1.53.9/common/options/keys.c:389:10: danger: '<unknown>' leaks here; was allocated at [(24)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/23)
#  387|     ++ks->nr_keys;
#  388|   
#  389|->   return ks;
#  390|   }
#  391|   

Error: CPPCHECK_WARNING (CWE-476): [#def64]
guestfs-tools-1.53.9/common/options/options.c:106: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  104|       error (EXIT_FAILURE, errno, "calloc");
#  105|   
#  106|->   drv->type = drv_d;
#  107|     drv->d.guest = optarg;
#  108|   

Error: CPPCHECK_WARNING (CWE-476): [#def65]
guestfs-tools-1.53.9/common/options/options.c:107: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  105|   
#  106|     drv->type = drv_d;
#  107|->   drv->d.guest = optarg;
#  108|   
#  109|     drv->next = *drvsp;

Error: CPPCHECK_WARNING (CWE-476): [#def66]
guestfs-tools-1.53.9/common/options/options.c:109: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  107|     drv->d.guest = optarg;
#  108|   
#  109|->   drv->next = *drvsp;
#  110|     *drvsp = drv;
#  111|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def67]
guestfs-tools-1.53.9/common/options/uri.c:228:17: warning[-Wanalyzer-malloc-leak]: leak of 'query_get(xmlParseURI(arg), "socket")'
guestfs-tools-1.53.9/common/options/uri.c:110:1: enter_function: entry to 'parse'
guestfs-tools-1.53.9/common/options/uri.c:118:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/uri.c:128:7: branch_false: ...to here
guestfs-tools-1.53.9/common/options/uri.c:128:6: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/options/uri.c:135:12: call_function: calling 'query_get' from 'parse'
guestfs-tools-1.53.9/common/options/uri.c:135:12: return_function: returning to 'parse' from 'query_get'
guestfs-tools-1.53.9/common/options/uri.c:228:17: danger: 'query_get(xmlParseURI(arg), "socket")' leaks here; was allocated at [(24)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/23)
#  226|     const char *end, *eq;
#  227|   
#  228|->   if (!query || STREQ (query, ""))
#  229|       return NULL;
#  230|   

Error: CPPCHECK_WARNING (CWE-476): [#def68]
guestfs-tools-1.53.9/common/parallel/parallel.c:139: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: thread_data
#  137|   
#  138|     for (i = 0; i < nr_threads; ++i) {
#  139|->     thread_data[i].thread_num = i;
#  140|       thread_data[i].trace = trace;
#  141|       thread_data[i].verbose = verbose;

Error: CPPCHECK_WARNING (CWE-476): [#def69]
guestfs-tools-1.53.9/common/parallel/parallel.c:140: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: thread_data
#  138|     for (i = 0; i < nr_threads; ++i) {
#  139|       thread_data[i].thread_num = i;
#  140|->     thread_data[i].trace = trace;
#  141|       thread_data[i].verbose = verbose;
#  142|       thread_data[i].work = work;

Error: CPPCHECK_WARNING (CWE-476): [#def70]
guestfs-tools-1.53.9/common/parallel/parallel.c:141: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: thread_data
#  139|       thread_data[i].thread_num = i;
#  140|       thread_data[i].trace = trace;
#  141|->     thread_data[i].verbose = verbose;
#  142|       thread_data[i].work = work;
#  143|     }

Error: CPPCHECK_WARNING (CWE-476): [#def71]
guestfs-tools-1.53.9/common/parallel/parallel.c:142: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: thread_data
#  140|       thread_data[i].trace = trace;
#  141|       thread_data[i].verbose = verbose;
#  142|->     thread_data[i].work = work;
#  143|     }
#  144|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
guestfs-tools-1.53.9/common/parallel/parallel.c:181:24: warning[-Wanalyzer-malloc-leak]: leak of 'fp'
guestfs-tools-1.53.9/common/parallel/parallel.c:193:8: branch_false: following 'false' branch (when 'err == 0')...
guestfs-tools-1.53.9/common/parallel/parallel.c:198:9: branch_false: ...to here
guestfs-tools-1.53.9/common/parallel/parallel.c:200:8: branch_false: following 'false' branch (when 'err == 0')...
guestfs-tools-1.53.9/common/parallel/parallel.c:206:9: branch_false: ...to here
guestfs-tools-1.53.9/common/parallel/parallel.c:206:8: branch_false: following 'false' branch...
guestfs-tools-1.53.9/common/parallel/parallel.c:209:9: branch_false: ...to here
guestfs-tools-1.53.9/common/parallel/parallel.c:213:10: acquire_memory: allocated here
guestfs-tools-1.53.9/common/parallel/parallel.c:214:8: branch_false: following 'false' branch (when 'fp' is non-NULL)...
guestfs-tools-1.53.9/common/parallel/parallel.c:221:9: branch_false: ...to here
guestfs-tools-1.53.9/common/parallel/parallel.c:181:24: danger: 'fp' leaks here; was allocated at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  179|       size_t i;               /* The current domain we're working on. */
#  180|       FILE *fp;
#  181|->     CLEANUP_FREE char *output = NULL;
#  182|       size_t output_len = 0;
#  183|       guestfs_h *g;

Error: CPPCHECK_WARNING (CWE-476): [#def73]
guestfs-tools-1.53.9/common/windows/windows.c:115: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ret
#  113|   
#  114|     /* Blindly convert any backslashes into forward slashes.  Is this good? */
#  115|->   for (i = 0; i < strlen (ret); ++i)
#  116|       if (ret[i] == '\\')
#  117|         ret[i] = '/';

Error: CPPCHECK_WARNING (CWE-476): [#def74]
guestfs-tools-1.53.9/df/main.c:228: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  226|           if (!drv)
#  227|             error (EXIT_FAILURE, errno, "calloc");
#  228|->         drv->type = drv_a;
#  229|           drv->a.filename = strdup (argv[optind]);
#  230|           if (!drv->a.filename)

Error: CPPCHECK_WARNING (CWE-476): [#def75]
guestfs-tools-1.53.9/df/main.c:229: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  227|             error (EXIT_FAILURE, errno, "calloc");
#  228|           drv->type = drv_a;
#  229|->         drv->a.filename = strdup (argv[optind]);
#  230|           if (!drv->a.filename)
#  231|             error (EXIT_FAILURE, errno, "strdup");

Error: CPPCHECK_WARNING (CWE-476): [#def76]
guestfs-tools-1.53.9/df/main.c:230: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  228|           drv->type = drv_a;
#  229|           drv->a.filename = strdup (argv[optind]);
#  230|->         if (!drv->a.filename)
#  231|             error (EXIT_FAILURE, errno, "strdup");
#  232|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def77]
guestfs-tools-1.53.9/df/main.c:238: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  236|           if (!drv)
#  237|             error (EXIT_FAILURE, errno, "calloc");
#  238|->         drv->type = drv_d;
#  239|           drv->d.guest = argv[optind];
#  240|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def78]
guestfs-tools-1.53.9/df/main.c:239: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  237|             error (EXIT_FAILURE, errno, "calloc");
#  238|           drv->type = drv_d;
#  239|->         drv->d.guest = argv[optind];
#  240|           drv->next = drvs;
#  241|           drvs = drv;

Error: CPPCHECK_WARNING (CWE-476): [#def79]
guestfs-tools-1.53.9/df/main.c:240: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  238|           drv->type = drv_d;
#  239|           drv->d.guest = argv[optind];
#  240|->         drv->next = drvs;
#  241|           drvs = drv;
#  242|         }

Error: CPPCHECK_WARNING (CWE-476): [#def80]
guestfs-tools-1.53.9/df/main.c:348: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: name
#  346|        * still make sense.
#  347|        */
#  348|->     p = strrchr (name, '/');
#  349|       if (p && strlen (p) > 1) {
#  350|         p = strdup (p+1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def81]
guestfs-tools-1.53.9/df/main.c:384:7: warning[-Wanalyzer-malloc-leak]: leak of ‘make_display_name(drvs)’
guestfs-tools-1.53.9/df/main.c:105:1: enter_function: entry to ‘main’
guestfs-tools-1.53.9/df/main.c:144:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:221:6: branch_true: following ‘true’ branch...
 branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:222:12: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/df/main.c:223:23: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:223:10: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/df/main.c:224:11: branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:236:12: branch_false: following ‘false’ branch (when ‘drv’ is non-NULL)...
guestfs-tools-1.53.9/df/main.c:238:9: branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:252:3: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/df/main.c:253:3: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:253:3: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/df/main.c:256:7: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:256:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/df/main.c:259:3: branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:259:3: branch_true: following ‘true’ branch (when ‘format_consumed != 0’)...
guestfs-tools-1.53.9/df/main.c:260:3: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:260:3: branch_true: following ‘true’ branch (when ‘blocksize_consumed != 0’)...
guestfs-tools-1.53.9/df/main.c:265:7: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:273:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/df/main.c:285:24: branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:290:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/df/main.c:293:5: branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:296:12: call_function: calling ‘make_display_name’ from ‘main’
guestfs-tools-1.53.9/df/main.c:296:12: return_function: returning to ‘main’ from ‘make_display_name’
guestfs-tools-1.53.9/df/main.c:384:7: danger: ‘make_display_name(drvs)’ leaks here; was allocated at [(45)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/44)
#  382|   
#  383|     /* Single disk or domain. */
#  384|->   if (drvs->next == NULL)
#  385|       ret = single_drive_display_name (drvs);
#  386|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def82]
guestfs-tools-1.53.9/df/main.c:404:8: warning[-Wanalyzer-malloc-leak]: leak of ‘single_drive_display_name(drvs)’
guestfs-tools-1.53.9/df/main.c:377:1: enter_function: entry to ‘make_display_name’
guestfs-tools-1.53.9/df/main.c:381:3: branch_true: following ‘true’ branch (when ‘drvs’ is non-NULL)...
guestfs-tools-1.53.9/df/main.c:384:7: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:384:6: branch_false: following ‘false’ branch...
 branch_false: ...to here
guestfs-tools-1.53.9/df/main.c:395:12: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/df/main.c:397:7: branch_true: ...to here
guestfs-tools-1.53.9/df/main.c:400:11: call_function: calling ‘single_drive_display_name’ from ‘make_display_name’
guestfs-tools-1.53.9/df/main.c:400:11: return_function: returning to ‘make_display_name’ from ‘single_drive_display_name’
guestfs-tools-1.53.9/df/main.c:404:8: danger: ‘single_drive_display_name(drvs)’ leaks here; was allocated at [(20)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/19)
#  402|   
#  403|       ret = realloc (ret, len + pluses + 1);
#  404|->     if (ret == NULL)
#  405|         error (EXIT_FAILURE, errno, "realloc");
#  406|       for (i = len; i < len + pluses; ++i)

Error: CPPCHECK_WARNING (CWE-476): [#def83]
guestfs-tools-1.53.9/edit/edit.c:198: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mp
#  196|   
#  197|       case 'm':
#  198|->       OPTION_m;
#  199|         inspector = 0;
#  200|         break;

Error: CPPCHECK_WARNING (CWE-476): [#def84]
guestfs-tools-1.53.9/edit/edit.c:233: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  231|           if (!drv)
#  232|             error (EXIT_FAILURE, errno, "calloc");
#  233|->         drv->type = drv_a;
#  234|           drv->a.filename = strdup (argv[optind]);
#  235|           if (!drv->a.filename)

Error: CPPCHECK_WARNING (CWE-476): [#def85]
guestfs-tools-1.53.9/edit/edit.c:234: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  232|             error (EXIT_FAILURE, errno, "calloc");
#  233|           drv->type = drv_a;
#  234|->         drv->a.filename = strdup (argv[optind]);
#  235|           if (!drv->a.filename)
#  236|             error (EXIT_FAILURE, errno, "strdup");

Error: CPPCHECK_WARNING (CWE-476): [#def86]
guestfs-tools-1.53.9/edit/edit.c:235: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  233|           drv->type = drv_a;
#  234|           drv->a.filename = strdup (argv[optind]);
#  235|->         if (!drv->a.filename)
#  236|             error (EXIT_FAILURE, errno, "strdup");
#  237|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def87]
guestfs-tools-1.53.9/edit/edit.c:243: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  241|           if (!drv)
#  242|             error (EXIT_FAILURE, errno, "calloc");
#  243|->         drv->type = drv_d;
#  244|           drv->d.guest = argv[optind];
#  245|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def88]
guestfs-tools-1.53.9/edit/edit.c:244: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  242|             error (EXIT_FAILURE, errno, "calloc");
#  243|           drv->type = drv_d;
#  244|->         drv->d.guest = argv[optind];
#  245|           drv->next = drvs;
#  246|           drvs = drv;

Error: CPPCHECK_WARNING (CWE-476): [#def89]
guestfs-tools-1.53.9/edit/edit.c:245: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  243|           drv->type = drv_d;
#  244|           drv->d.guest = argv[optind];
#  245|->         drv->next = drvs;
#  246|           drvs = drv;
#  247|         }

Error: CPPCHECK_WARNING (CWE-476): [#def90]
guestfs-tools-1.53.9/inspector/inspector.c:233: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  231|           if (!drv)
#  232|             error (EXIT_FAILURE, errno, "calloc");
#  233|->         drv->type = drv_a;
#  234|           drv->a.filename = strdup (argv[optind]);
#  235|           if (!drv->a.filename)

Error: CPPCHECK_WARNING (CWE-476): [#def91]
guestfs-tools-1.53.9/inspector/inspector.c:234: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  232|             error (EXIT_FAILURE, errno, "calloc");
#  233|           drv->type = drv_a;
#  234|->         drv->a.filename = strdup (argv[optind]);
#  235|           if (!drv->a.filename)
#  236|             error (EXIT_FAILURE, errno, "strdup");

Error: CPPCHECK_WARNING (CWE-476): [#def92]
guestfs-tools-1.53.9/inspector/inspector.c:235: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  233|           drv->type = drv_a;
#  234|           drv->a.filename = strdup (argv[optind]);
#  235|->         if (!drv->a.filename)
#  236|             error (EXIT_FAILURE, errno, "strdup");
#  237|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def93]
guestfs-tools-1.53.9/inspector/inspector.c:243: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  241|           if (!drv)
#  242|             error (EXIT_FAILURE, errno, "calloc");
#  243|->         drv->type = drv_d;
#  244|           drv->d.guest = argv[optind];
#  245|           drv->next = drvs;

Error: CPPCHECK_WARNING (CWE-476): [#def94]
guestfs-tools-1.53.9/inspector/inspector.c:244: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  242|             error (EXIT_FAILURE, errno, "calloc");
#  243|           drv->type = drv_d;
#  244|->         drv->d.guest = argv[optind];
#  245|           drv->next = drvs;
#  246|           drvs = drv;

Error: CPPCHECK_WARNING (CWE-476): [#def95]
guestfs-tools-1.53.9/inspector/inspector.c:245: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: drv
#  243|           drv->type = drv_d;
#  244|           drv->d.guest = argv[optind];
#  245|->         drv->next = drvs;
#  246|           drvs = drv;
#  247|         }

Error: CPPCHECK_WARNING (CWE-401): [#def96]
guestfs-tools-1.53.9/make-fs/make-fs.c:303: error[memleak]: Memory leak: buffer
#  301|     if (pipe (fd) == -1) {
#  302|       perror ("pipe");
#  303|->     return -1;
#  304|     }
#  305|     pid = fork ();

Error: CPPCHECK_WARNING (CWE-401): [#def97]
guestfs-tools-1.53.9/make-fs/make-fs.c:308: error[memleak]: Memory leak: buffer
#  306|     if (pid == -1) {
#  307|       perror ("fork");
#  308|->     return -1;
#  309|     }
#  310|     if (pid > 0) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def98]
guestfs-tools-1.53.9/make-fs/make-fs.c:343:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[0]’
guestfs-tools-1.53.9/make-fs/make-fs.c:296:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:301:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:301:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:305:9: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:306:6: branch_true: following ‘true’ branch (when ‘pid == -1’)...
guestfs-tools-1.53.9/make-fs/make-fs.c:307:5: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:343:1: danger: ‘fd[0]’ leaks here
#  341|     perror ("execvp");
#  342|     _exit (EXIT_FAILURE);
#  343|-> }
#  344|   
#  345|   /* Execute a command in the background (don't wait) and send the

Error: GCC_ANALYZER_WARNING (CWE-775): [#def99]
guestfs-tools-1.53.9/make-fs/make-fs.c:343:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[1]’
guestfs-tools-1.53.9/make-fs/make-fs.c:296:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:301:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:301:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:305:9: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:306:6: branch_true: following ‘true’ branch (when ‘pid == -1’)...
guestfs-tools-1.53.9/make-fs/make-fs.c:307:5: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:343:1: danger: ‘fd[1]’ leaks here
#  341|     perror ("execvp");
#  342|     _exit (EXIT_FAILURE);
#  343|-> }
#  344|   
#  345|   /* Execute a command in the background (don't wait) and send the

Error: GCC_ANALYZER_WARNING (CWE-775): [#def100]
guestfs-tools-1.53.9/make-fs/make-fs.c:356:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[0]’
guestfs-tools-1.53.9/make-fs/make-fs.c:354:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:358:14: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:359:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:360:5: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:356:12: danger: ‘fd[0]’ leaks here
#  354|     if (pipe (fd) == -1) {
#  355|       perror ("pipe");
#  356|->     return -1;
#  357|     }
#  358|     *pid_rtn = fork ();

Error: GCC_ANALYZER_WARNING (CWE-775): [#def101]
guestfs-tools-1.53.9/make-fs/make-fs.c:356:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[1]’
guestfs-tools-1.53.9/make-fs/make-fs.c:354:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:358:14: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:359:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:360:5: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:356:12: danger: ‘fd[1]’ leaks here
#  354|     if (pipe (fd) == -1) {
#  355|       perror ("pipe");
#  356|->     return -1;
#  357|     }
#  358|     *pid_rtn = fork ();

Error: GCC_ANALYZER_WARNING (CWE-775): [#def102]
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(tmpfile, "r")’
guestfs-tools-1.53.9/make-fs/make-fs.c:399:1: enter_function: entry to ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:410:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:414:8: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:415:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:419:3: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:421:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:425:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:425:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:426:17: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:427:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:432:5: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:439:9: call_function: calling ‘exec_command’ from ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:439:9: return_function: returning to ‘estimate_input’ from ‘exec_command’
guestfs-tools-1.53.9/make-fs/make-fs.c:439:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: acquire_resource: opened here
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: danger: ‘fopen(tmpfile, "r")’ leaks here; was opened at [(25)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/24)
#  440|         return -1;
#  441|   
#  442|->     fp = fopen (tmpfile, "r");
#  443|       if (fp == NULL) {
#  444|         perror (tmpfile);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def103]
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(tmpfile, "r")’
guestfs-tools-1.53.9/make-fs/make-fs.c:399:1: enter_function: entry to ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:410:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:414:8: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:415:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:419:3: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:421:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:425:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:425:6: branch_true: following ‘true’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:426:17: branch_true: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:427:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:432:5: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:439:9: call_function: calling ‘exec_command’ from ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:439:9: return_function: returning to ‘estimate_input’ from ‘exec_command’
guestfs-tools-1.53.9/make-fs/make-fs.c:439:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: acquire_memory: allocated here
guestfs-tools-1.53.9/make-fs/make-fs.c:442:10: danger: ‘fopen(tmpfile, "r")’ leaks here; was allocated at [(25)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/24)
#  440|         return -1;
#  441|   
#  442|->     fp = fopen (tmpfile, "r");
#  443|       if (fp == NULL) {
#  444|         perror (tmpfile);

Error: CPPCHECK_WARNING (CWE-404): [#def104]
guestfs-tools-1.53.9/make-fs/make-fs.c:449: error[resourceLeak]: Resource leak: fp
#  447|       if (fgets (line, sizeof line, fp) == NULL) {
#  448|         perror ("fgets");
#  449|->       return -1;
#  450|       }
#  451|   

Error: CPPCHECK_WARNING (CWE-404): [#def105]
guestfs-tools-1.53.9/make-fs/make-fs.c:455: error[resourceLeak]: Resource leak: fp
#  453|         fprintf (stderr, _("%s: cannot parse the output of ‘du’ command: %s\n"),
#  454|                  getprogname (), line);
#  455|->       return -1;
#  456|       }
#  457|     }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def106]
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(tmpfile, "r")’
guestfs-tools-1.53.9/make-fs/make-fs.c:399:1: enter_function: entry to ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:410:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:414:8: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:415:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:419:3: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:421:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:425:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:425:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:459:5: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:464:9: call_function: calling ‘exec_command’ from ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:464:9: return_function: returning to ‘estimate_input’ from ‘exec_command’
guestfs-tools-1.53.9/make-fs/make-fs.c:464:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: acquire_resource: opened here
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: danger: ‘fopen(tmpfile, "r")’ leaks here; was opened at [(17)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/16)
#  465|         return -1;
#  466|   
#  467|->     fp = fopen (tmpfile, "r");
#  468|       if (fp == NULL) {
#  469|         perror (tmpfile);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def107]
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(tmpfile, "r")’
guestfs-tools-1.53.9/make-fs/make-fs.c:399:1: enter_function: entry to ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:410:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:414:8: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:415:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:419:3: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:421:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:425:7: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:425:6: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:459:5: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:464:9: call_function: calling ‘exec_command’ from ‘estimate_input’
guestfs-tools-1.53.9/make-fs/make-fs.c:464:9: return_function: returning to ‘estimate_input’ from ‘exec_command’
guestfs-tools-1.53.9/make-fs/make-fs.c:464:8: branch_false: following ‘false’ branch...
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: branch_false: ...to here
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: acquire_memory: allocated here
guestfs-tools-1.53.9/make-fs/make-fs.c:467:10: danger: ‘fopen(tmpfile, "r")’ leaks here; was allocated at [(17)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/16)
#  465|         return -1;
#  466|   
#  467|->     fp = fopen (tmpfile, "r");
#  468|       if (fp == NULL) {
#  469|         perror (tmpfile);

Error: CPPCHECK_WARNING (CWE-404): [#def108]
guestfs-tools-1.53.9/make-fs/make-fs.c:474: error[resourceLeak]: Resource leak: fp
#  472|       if (fgets (line, sizeof line, fp) == NULL) {
#  473|         perror ("fgets");
#  474|->       return -1;
#  475|       }
#  476|   

Error: CPPCHECK_WARNING (CWE-404): [#def109]
guestfs-tools-1.53.9/make-fs/make-fs.c:484: error[resourceLeak]: Resource leak: fp
#  482|       if (*ifmt_rtn == NULL) {
#  483|         perror ("strdup");
#  484|->       return -1;
#  485|       }
#  486|   

Error: CPPCHECK_WARNING (CWE-404): [#def110]
guestfs-tools-1.53.9/make-fs/make-fs.c:490: error[resourceLeak]: Resource leak: fp
#  488|         fprintf (stderr, _("%s: %s: input is not a directory, tar archive or compressed tar archive\n"),
#  489|                  getprogname (), input);
#  490|->       return -1;
#  491|       }
#  492|   

Error: CPPCHECK_WARNING (CWE-404): [#def111]
guestfs-tools-1.53.9/make-fs/make-fs.c:521: error[resourceLeak]: Resource leak: fp
#  519|           fprintf (stderr, _("%s: %s: unknown compressed input format (%s)\n"),
#  520|                    getprogname (), input, line);
#  521|->         return -1;
#  522|         }
#  523|   

Error: CPPCHECK_WARNING (CWE-404): [#def112]
guestfs-tools-1.53.9/make-fs/make-fs.c:526: error[resourceLeak]: Resource leak: fp
#  524|         *estimate_rtn = 0;
#  525|         if (exec_command_count_output ((char **) argv, estimate_rtn) == -1)
#  526|->         return -1;
#  527|       }
#  528|       else {

Error: CPPCHECK_WARNING (CWE-404): [#def113]
guestfs-tools-1.53.9/make-fs/make-fs.c:537: error[resourceLeak]: Resource leak: fp
#  535|     }
#  536|   
#  537|->   return 0;
#  538|   }
#  539|   

Error: CPPCHECK_WARNING (CWE-401): [#def114]
guestfs-tools-1.53.9/make-fs/make-fs.c:678: error[memleak]: Memory leak: output
#  676|     /* Input.  What is it?  Estimate how much space it will need. */
#  677|     if (estimate_input (input, &estimate, &ifmt) == -1)
#  678|->     return -1;
#  679|   
#  680|     if (verbose) {

Error: CPPCHECK_WARNING (CWE-401): [#def115]
guestfs-tools-1.53.9/make-fs/make-fs.c:733: error[memleak]: Memory leak: output
#  731|     else
#  732|       if (parse_size (size_str, estimate, &size) == -1)
#  733|->       return -1;
#  734|   
#  735|     /* Create the output disk. */

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-86.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameguestfs-tools-1.53.9-1.fc43
store-results-to/tmp/tmpwfdm_s26/guestfs-tools-1.53.9-1.fc43.tar.xz
time-created2025-04-25 12:59:47
time-finished2025-04-25 13:02:36
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpwfdm_s26/guestfs-tools-1.53.9-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpwfdm_s26/guestfs-tools-1.53.9-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9