Fixed findings

List of Findings

Error: COMPILER_WARNING: [#def1]
libnl-3.11.0/lib/route/cls/ematch_syntax.c: scope_hint: In function 'ematch_parse'
libnl-3.11.0/lib/route/cls/ematch_syntax.c:72:25: warning[-Wunused-but-set-variable=]: variable 'ematch_nerrs' set but not used
#   72 | #define yynerrs         ematch_nerrs
#      |                         ^~~~~~~~~~~~
libnl-3.11.0/lib/route/cls/ematch_syntax.c:1368:9: note: in expansion of macro 'yynerrs'
# 1368 |     int yynerrs = 0;
#      |         ^~~~~~~
#   70|   #define yyerror         ematch_error
#   71|   #define yydebug         ematch_debug
#   72|-> #define yynerrs         ematch_nerrs
#   73|   
#   74|   /* First part of user prologue.  */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: warning[-Wanalyzer-malloc-leak]: leak of 'mpls_encap'
libnl-3.11.0/lib/route/nh_encap_mpls.c:111:12: branch_false: following 'false' branch (when 'addr' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:115:12: branch_false: following 'false' branch (when 'rtnh_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: acquire_memory: allocated here
libnl-3.11.0/lib/route/nh_encap_mpls.c:119:12: branch_false: following 'false' branch (when 'mpls_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: throw: if 'nl_addr_get' throws an exception...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: danger: 'mpls_encap' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  122|   	}
#  123|   
#  124|-> 	mpls_encap->dst = nl_addr_get(addr);
#  125|   	mpls_encap->ttl = ttl;
#  126|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: warning[-Wanalyzer-malloc-leak]: leak of 'rtnh_encap'
libnl-3.11.0/lib/route/nh_encap_mpls.c:111:12: branch_false: following 'false' branch (when 'addr' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: acquire_memory: allocated here
libnl-3.11.0/lib/route/nh_encap_mpls.c:115:12: branch_false: following 'false' branch (when 'rtnh_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:119:12: branch_false: following 'false' branch (when 'mpls_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: throw: if 'nl_addr_get' throws an exception...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: danger: 'rtnh_encap' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  122|   	}
#  123|   
#  124|-> 	mpls_encap->dst = nl_addr_get(addr);
#  125|   	mpls_encap->ttl = ttl;
#  126|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: warning[-Wanalyzer-malloc-leak]: leak of 'mpls_encap'
libnl-3.11.0/lib/route/nh_encap_mpls.c:111:12: branch_false: following 'false' branch (when 'addr' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:115:12: branch_false: following 'false' branch (when 'rtnh_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: acquire_memory: allocated here
libnl-3.11.0/lib/route/nh_encap_mpls.c:119:12: branch_false: following 'false' branch (when 'mpls_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: throw: if 'nh_set_encap' throws an exception...
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: danger: 'mpls_encap' leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
#  128|   	rtnh_encap->ops = &mpls_encap_ops;
#  129|   
#  130|-> 	nh_set_encap(nh, rtnh_encap);
#  131|   
#  132|   	return 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: warning[-Wanalyzer-malloc-leak]: leak of 'rtnh_encap'
libnl-3.11.0/lib/route/nh_encap_mpls.c:111:12: branch_false: following 'false' branch (when 'addr' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:114:22: acquire_memory: allocated here
libnl-3.11.0/lib/route/nh_encap_mpls.c:115:12: branch_false: following 'false' branch (when 'rtnh_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:118:22: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:119:12: branch_false: following 'false' branch (when 'mpls_encap' is non-NULL)...
libnl-3.11.0/lib/route/nh_encap_mpls.c:124:27: branch_false: ...to here
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: throw: if 'nh_set_encap' throws an exception...
libnl-3.11.0/lib/route/nh_encap_mpls.c:130:9: danger: 'rtnh_encap' leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  128|   	rtnh_encap->ops = &mpls_encap_ops;
#  129|   
#  130|-> 	nh_set_encap(nh, rtnh_encap);
#  131|   
#  132|   	return 0;

Error: COMPILER_WARNING: [#def6]
libnl-3.11.0/lib/route/pktloc_syntax.c: scope_hint: In function 'pktloc_parse'
libnl-3.11.0/lib/route/pktloc_syntax.c:72:25: warning[-Wunused-but-set-variable=]: variable 'pktloc_nerrs' set but not used
#   72 | #define yynerrs         pktloc_nerrs
#      |                         ^~~~~~~~~~~~
libnl-3.11.0/lib/route/pktloc_syntax.c:1236:9: note: in expansion of macro 'yynerrs'
# 1236 |     int yynerrs = 0;
#      |         ^~~~~~~
#   70|   #define yyerror         pktloc_error
#   71|   #define yydebug         pktloc_debug
#   72|-> #define yynerrs         pktloc_nerrs
#   73|   
#   74|   /* First part of user prologue.  */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libnl-3.11.0/src/nl-class-add.c:106:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:106:27: throw: if ‘nl_cli_print_version’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:106:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  104|   		case 'q': quiet = 1; break;
#  105|   		case 'h': print_usage(); break;
#  106|-> 		case 'v': nl_cli_print_version(); break;
#  107|   		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  108|   		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
libnl-3.11.0/src/nl-class-add.c:107:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:107:27: throw: if ‘nl_cli_tc_parse_dev’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:107:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  105|   		case 'h': print_usage(); break;
#  106|   		case 'v': nl_cli_print_version(); break;
#  107|-> 		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  108|   		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
#  109|   		case 'i': id = strdup(optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
libnl-3.11.0/src/nl-class-add.c:108:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:108:27: throw: if ‘nl_cli_tc_parse_parent’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:108:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  106|   		case 'v': nl_cli_print_version(); break;
#  107|   		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  108|-> 		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
#  109|   		case 'i': id = strdup(optarg); break;
#  110|   		case ARG_UPDATE: flags = NLM_F_CREATE; break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
libnl-3.11.0/src/nl-class-add.c:112:31: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:112:31: throw: if ‘nl_cli_tc_parse_mtu’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:112:31: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  110|   		case ARG_UPDATE: flags = NLM_F_CREATE; break;
#  111|   		case ARG_UPDATE_ONLY: flags = 0; break;
#  112|-> 		case ARG_MTU: nl_cli_tc_parse_mtu(tc, optarg); break;
#  113|   		case ARG_MPU: nl_cli_tc_parse_mpu(tc, optarg); break;
#  114|   		case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
libnl-3.11.0/src/nl-class-add.c:113:31: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:113:31: throw: if ‘nl_cli_tc_parse_mpu’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:113:31: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  111|   		case ARG_UPDATE_ONLY: flags = 0; break;
#  112|   		case ARG_MTU: nl_cli_tc_parse_mtu(tc, optarg); break;
#  113|-> 		case ARG_MPU: nl_cli_tc_parse_mpu(tc, optarg); break;
#  114|   		case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break;
#  115|   		case ARG_LINKTYPE: nl_cli_tc_parse_linktype(tc, optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
libnl-3.11.0/src/nl-class-add.c:114:36: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:114:36: throw: if ‘nl_cli_tc_parse_overhead’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:114:36: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  112|   		case ARG_MTU: nl_cli_tc_parse_mtu(tc, optarg); break;
#  113|   		case ARG_MPU: nl_cli_tc_parse_mpu(tc, optarg); break;
#  114|-> 		case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break;
#  115|   		case ARG_LINKTYPE: nl_cli_tc_parse_linktype(tc, optarg); break;
#  116|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
libnl-3.11.0/src/nl-class-add.c:115:36: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:115:36: throw: if ‘nl_cli_tc_parse_linktype’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:115:36: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  113|   		case ARG_MPU: nl_cli_tc_parse_mpu(tc, optarg); break;
#  114|   		case ARG_OVERHEAD: nl_cli_tc_parse_overhead(tc, optarg); break;
#  115|-> 		case ARG_LINKTYPE: nl_cli_tc_parse_linktype(tc, optarg); break;
#  116|   		}
#  117|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
libnl-3.11.0/src/nl-class-add.c:122:14: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-class-add.c:153:1: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:119:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:122:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:122:14: throw: if ‘rtnl_tc_get_ifindex’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:122:14: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  120|   		print_usage();
#  121|   
#  122|-> 	if (!rtnl_tc_get_ifindex(tc))
#  123|   		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  124|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
libnl-3.11.0/src/nl-class-add.c:123:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-class-add.c:153:1: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:119:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:122:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:122:12: branch_true: following ‘true’ branch...
libnl-3.11.0/src/nl-class-add.c:123:17: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:123:17: throw: if ‘nl_cli_fatal’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:123:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2)
#  121|   
#  122|   	if (!rtnl_tc_get_ifindex(tc))
#  123|-> 		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  124|   
#  125|   	if (!rtnl_tc_get_parent(tc))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
libnl-3.11.0/src/nl-class-add.c:125:14: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-class-add.c:153:1: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:119:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:122:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:122:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:125:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:125:14: throw: if ‘rtnl_tc_get_parent’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:125:14: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/2)
#  123|   		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  124|   
#  125|-> 	if (!rtnl_tc_get_parent(tc))
#  126|   		nl_cli_fatal(EINVAL, "You must specify a parent (--parent=XXX)");
#  127|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
libnl-3.11.0/src/nl-class-add.c:126:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-class-add.c:153:1: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:119:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:122:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:122:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:125:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:125:12: branch_true: following ‘true’ branch...
libnl-3.11.0/src/nl-class-add.c:126:17: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:126:17: throw: if ‘nl_cli_fatal’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:126:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/2)
#  124|   
#  125|   	if (!rtnl_tc_get_parent(tc))
#  126|-> 		nl_cli_fatal(EINVAL, "You must specify a parent (--parent=XXX)");
#  127|   
#  128|   	if (id) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
libnl-3.11.0/src/nl-class-add.c:129:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-class-add.c:100:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-class-add.c:103:17: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:109:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-class-add.c:100:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-class-add.c:153:1: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:119:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:122:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:122:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:125:14: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:125:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-class-add.c:128:12: branch_false: ...to here
libnl-3.11.0/src/nl-class-add.c:128:12: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnl-3.11.0/src/nl-class-add.c:129:17: branch_true: ...to here
libnl-3.11.0/src/nl-class-add.c:129:17: throw: if ‘nl_cli_tc_parse_handle’ throws an exception...
libnl-3.11.0/src/nl-class-add.c:129:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/2)
#  127|   
#  128|   	if (id) {
#  129|-> 		nl_cli_tc_parse_handle(tc, id, 1);
#  130|   		free(id);
#  131|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
libnl-3.11.0/src/nl-qdisc-add.c:99:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:99:27: throw: if ‘nl_cli_print_version’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:99:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   97|   		case 'q': quiet = 1; break;
#   98|   		case 'h': print_usage(); break;
#   99|-> 		case 'v': nl_cli_print_version(); break;
#  100|   		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  101|   		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
libnl-3.11.0/src/nl-qdisc-add.c:100:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:100:27: throw: if ‘nl_cli_tc_parse_dev’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:100:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   98|   		case 'h': print_usage(); break;
#   99|   		case 'v': nl_cli_print_version(); break;
#  100|-> 		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  101|   		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
#  102|   		case 'i': id = strdup(optarg); break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
libnl-3.11.0/src/nl-qdisc-add.c:101:27: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:101:27: throw: if ‘nl_cli_tc_parse_parent’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:101:27: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#   99|   		case 'v': nl_cli_print_version(); break;
#  100|   		case 'd': nl_cli_tc_parse_dev(tc, link_cache, optarg); break;
#  101|-> 		case 'p': nl_cli_tc_parse_parent(tc, optarg); break;
#  102|   		case 'i': id = strdup(optarg); break;
#  103|   		case ARG_UPDATE: flags = NLM_F_CREATE; break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
libnl-3.11.0/src/nl-qdisc-add.c:113:14: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:144:1: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:110:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:113:14: throw: if ‘rtnl_tc_get_ifindex’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  111|   		print_usage();
#  112|   
#  113|-> 	if (!rtnl_tc_get_ifindex(tc))
#  114|   		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  115|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
libnl-3.11.0/src/nl-qdisc-add.c:114:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:144:1: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:110:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:113:12: branch_true: following ‘true’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:114:17: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:114:17: throw: if ‘nl_cli_fatal’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:114:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  112|   
#  113|   	if (!rtnl_tc_get_ifindex(tc))
#  114|-> 		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  115|   
#  116|   	if (!rtnl_tc_get_parent(tc))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def24]
libnl-3.11.0/src/nl-qdisc-add.c:116:14: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:144:1: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:110:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:113:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:116:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:116:14: throw: if ‘rtnl_tc_get_parent’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:116:14: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  114|   		nl_cli_fatal(EINVAL, "You must specify a network device (--dev=XXX)");
#  115|   
#  116|-> 	if (!rtnl_tc_get_parent(tc))
#  117|   		nl_cli_fatal(EINVAL, "You must specify a parent");
#  118|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
libnl-3.11.0/src/nl-qdisc-add.c:117:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:144:1: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:110:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:113:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:116:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:116:12: branch_true: following ‘true’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:117:17: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:117:17: throw: if ‘nl_cli_fatal’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:117:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  115|   
#  116|   	if (!rtnl_tc_get_parent(tc))
#  117|-> 		nl_cli_fatal(EINVAL, "You must specify a parent");
#  118|   
#  119|   	if (id) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
libnl-3.11.0/src/nl-qdisc-add.c:120:17: warning[-Wanalyzer-malloc-leak]: leak of ‘id’
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_false: following ‘false’ branch (when ‘c != -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:96:17: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:102:32: acquire_memory: allocated here
libnl-3.11.0/src/nl-qdisc-add.c:93:20: branch_true: following ‘true’ branch (when ‘c == -1’)...
libnl-3.11.0/src/nl-qdisc-add.c:144:1: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:110:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:113:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:113:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:116:14: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:116:12: branch_false: following ‘false’ branch...
libnl-3.11.0/src/nl-qdisc-add.c:119:12: branch_false: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:119:12: branch_true: following ‘true’ branch (when ‘id’ is non-NULL)...
libnl-3.11.0/src/nl-qdisc-add.c:120:17: branch_true: ...to here
libnl-3.11.0/src/nl-qdisc-add.c:120:17: throw: if ‘nl_cli_tc_parse_handle’ throws an exception...
libnl-3.11.0/src/nl-qdisc-add.c:120:17: danger: ‘id’ leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  118|   
#  119|   	if (id) {
#  120|-> 		nl_cli_tc_parse_handle(tc, id, 1);
#  121|   		free(id);
#  122|   	}

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-87.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-namelibnl3-3.12.0-2.fc44
diffbase-store-results-to/tmp/tmpzkzfcsln/libnl3-3.12.0-2.fc44.tar.xz
diffbase-time-created2026-01-08 19:03:04
diffbase-time-finished2026-01-08 19:05:50
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpzkzfcsln/libnl3-3.12.0-2.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpzkzfcsln/libnl3-3.12.0-2.fc44.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-87.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-namelibnl3-3.11.0-6.fc43
store-results-to/tmp/tmpsuph_wqe/libnl3-3.11.0-6.fc43.tar.xz
time-created2026-01-08 18:59:38
time-finished2026-01-08 19:02:50
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpsuph_wqe/libnl3-3.11.0-6.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpsuph_wqe/libnl3-3.11.0-6.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9