Fixed findings

List of Findings

Error: COMPILER_WARNING (CWE-457): [#def1]
postgresql-18beta1/postgresql-17.2/src/backend/utils/adt/jsonb_util.c: scope_hint: In function ‘compareJsonbContainers’
postgresql-18beta1/postgresql-17.2/src/backend/utils/adt/jsonb_util.c:294:34: warning[-Wmaybe-uninitialized]: ‘va.type’ may be used uninitialized
#  294 |                         res = (va.type > vb.type) ? 1 : -1;
#      |                                ~~^~~~~
postgresql-18beta1/postgresql-17.2/src/backend/utils/adt/jsonb_util.c:202:33: note: ‘va’ declared here
#  202 |                 JsonbValue      va,
#      |                                 ^~
#  292|   			Assert(vb.type != jbvBinary);
#  293|   			/* Type-defined order */
#  294|-> 			res = (va.type > vb.type) ? 1 : -1;
#  295|   		}
#  296|   	}

Error: COMPILER_WARNING (CWE-457): [#def2]
postgresql-18beta1/postgresql-17.2/src/backend/utils/adt/jsonb_util.c:294:44: warning[-Wmaybe-uninitialized]: ‘vb.type’ may be used uninitialized
#  294 |                         res = (va.type > vb.type) ? 1 : -1;
#      |                                          ~~^~~~~
postgresql-18beta1/postgresql-17.2/src/backend/utils/adt/jsonb_util.c:203:41: note: ‘vb’ declared here
#  203 |                                         vb;
#      |                                         ^~
#  292|   			Assert(vb.type != jbvBinary);
#  293|   			/* Type-defined order */
#  294|-> 			res = (va.type > vb.type) ? 1 : -1;
#  295|   		}
#  296|   	}

Error: GCC_ANALYZER_WARNING (CWE-404): [#def3]
postgresql-18beta1/postgresql-17.2/src/bin/pg_combinebackup/load_manifest.c:234:9: warning[-Wanalyzer-va-list-leak]: missing call to ‘va_end’
postgresql-18beta1/postgresql-17.2/src/bin/pg_combinebackup/load_manifest.c:233:9: acquire_resource: ‘va_start’ called here
postgresql-18beta1/postgresql-17.2/src/bin/pg_combinebackup/load_manifest.c:234:9: danger: missing call to ‘va_end’ to match ‘va_start’ at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  232|   
#  233|   	va_start(ap, fmt);
#  234|-> 	pg_log_generic_v(PG_LOG_ERROR, PG_LOG_PRIMARY, gettext(fmt), ap);
#  235|   	va_end(ap);
#  236|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:121:21: warning[-Wanalyzer-malloc-leak]: leak of ‘ctx’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:81:15: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:82:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:84:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:121:21: danger: ‘ctx’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  119|   	}
#  120|   
#  121|-> 	ctx->hash = pg_cryptohash_create(type);
#  122|   	if (ctx->hash == NULL)
#  123|   	{

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:171:28: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:171:28: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  169|   		memset(shrinkbuf, 0, digest_size);
#  170|   
#  171|-> 		hash_ctx = pg_cryptohash_create(ctx->type);
#  172|   		if (hash_ctx == NULL)
#  173|   		{

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:172:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  177|   		}
#  178|   
#  179|-> 		if (pg_cryptohash_init(hash_ctx) < 0 ||
#  180|   			pg_cryptohash_update(hash_ctx, key, len) < 0 ||
#  181|   			pg_cryptohash_final(hash_ctx, shrinkbuf, digest_size) < 0)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:180:25: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:172:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:180:25: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:180:25: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
#  178|   
#  179|   		if (pg_cryptohash_init(hash_ctx) < 0 ||
#  180|-> 			pg_cryptohash_update(hash_ctx, key, len) < 0 ||
#  181|   			pg_cryptohash_final(hash_ctx, shrinkbuf, digest_size) < 0)
#  182|   		{

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:181:25: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:172:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:180:25: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:181:25: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:181:25: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
#  179|   		if (pg_cryptohash_init(hash_ctx) < 0 ||
#  180|   			pg_cryptohash_update(hash_ctx, key, len) < 0 ||
#  181|-> 			pg_cryptohash_final(hash_ctx, shrinkbuf, digest_size) < 0)
#  182|   		{
#  183|   			ctx->error = PG_HMAC_ERROR_INTERNAL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:184:42: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:172:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:184:42: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4)
#  182|   		{
#  183|   			ctx->error = PG_HMAC_ERROR_INTERNAL;
#  184|-> 			ctx->errreason = pg_cryptohash_error(hash_ctx);
#  185|   			pg_cryptohash_free(hash_ctx);
#  186|   			FREE(shrinkbuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:185:25: warning[-Wanalyzer-malloc-leak]: leak of ‘shrinkbuf’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:145:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:148:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:158:12: branch_true: following ‘true’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: branch_true: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:163:29: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:164:20: branch_false: following ‘false’ branch (when ‘shrinkbuf’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:169:17: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:172:20: branch_false: following ‘false’ branch...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:179:21: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:185:25: danger: ‘shrinkbuf’ leaks here; was allocated at [(5)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/4)
#  183|   			ctx->error = PG_HMAC_ERROR_INTERNAL;
#  184|   			ctx->errreason = pg_cryptohash_error(hash_ctx);
#  185|-> 			pg_cryptohash_free(hash_ctx);
#  186|   			FREE(shrinkbuf);
#  187|   			return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:259:13: warning[-Wanalyzer-malloc-leak]: leak of ‘h’
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:248:12: branch_false: following ‘false’ branch (when ‘ctx’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:251:13: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:251:13: acquire_memory: allocated here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:252:12: branch_false: following ‘false’ branch (when ‘h’ is non-NULL)...
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:257:9: branch_false: ...to here
postgresql-18beta1/postgresql-17.2/src/common/hmac.c:259:13: danger: ‘h’ leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  257|   	memset(h, 0, ctx->digest_size);
#  258|   
#  259|-> 	if (pg_cryptohash_final(ctx->hash, h, ctx->digest_size) < 0)
#  260|   	{
#  261|   		ctx->error = PG_HMAC_ERROR_INTERNAL;

Error: CPPCHECK_WARNING (CWE-457): [#def12]
postgresql-18beta1/src/backend/access/gist/gistutil.c:207: error[uninitvar]: Uninitialized variable: &attrsize
#  205|   										giststate->supportCollation[i],
#  206|   										PointerGetDatum(evec),
#  207|-> 										PointerGetDatum(&attrsize));
#  208|   
#  209|   			isnull[i] = false;

Error: CPPCHECK_WARNING (CWE-457): [#def13]
postgresql-18beta1/src/backend/access/gist/gistutil.c:276: error[uninitvar]: Uninitialized variable: &dstsize
#  274|   								 giststate->supportCollation[attno],
#  275|   								 PointerGetDatum(evec),
#  276|-> 								 PointerGetDatum(&dstsize));
#  277|   	}
#  278|   }

Error: COMPILER_WARNING (CWE-457): [#def14]
postgresql-18beta1/src/backend/utils/adt/jsonb_util.c: scope_hint: In function ‘compareJsonbContainers’
postgresql-18beta1/src/backend/utils/adt/jsonb_util.c:301:34: warning[-Wmaybe-uninitialized]: ‘va.type’ may be used uninitialized
#  301 |                         res = (va.type > vb.type) ? 1 : -1;
#      |                                ~~^~~~~
postgresql-18beta1/src/backend/utils/adt/jsonb_util.c:202:33: note: ‘va’ declared here
#  202 |                 JsonbValue      va,
#      |                                 ^~
#  299|   			Assert(vb.type != jbvBinary);
#  300|   			/* Type-defined order */
#  301|-> 			res = (va.type > vb.type) ? 1 : -1;
#  302|   		}
#  303|   	}

Error: COMPILER_WARNING (CWE-457): [#def15]
postgresql-18beta1/src/backend/utils/adt/jsonb_util.c:301:44: warning[-Wmaybe-uninitialized]: ‘vb.type’ may be used uninitialized
#  301 |                         res = (va.type > vb.type) ? 1 : -1;
#      |                                          ~~^~~~~
postgresql-18beta1/src/backend/utils/adt/jsonb_util.c:203:41: note: ‘vb’ declared here
#  203 |                                         vb;
#      |                                         ^~
#  299|   			Assert(vb.type != jbvBinary);
#  300|   			/* Type-defined order */
#  301|-> 			res = (va.type > vb.type) ? 1 : -1;
#  302|   		}
#  303|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:143:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘context’
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:87:43: branch_false: following ‘false’ branch...
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:100:9: branch_false: ...to here
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:124:12: branch_false: following ‘false’ branch (when ‘ident’ is NULL)...
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:141:17: branch_false: ...to here
postgresql-18beta1/src/backend/utils/adt/mcxtfuncs.c:143:16: danger: dereference of NULL ‘context’
#  141|   		nulls[1] = true;
#  142|   
#  143|-> 	type = ContextTypeToString(context->type);
#  144|   
#  145|   	values[2] = CStringGetTextDatum(type);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def17]
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:959:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*num_contexts’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:860:1: enter_function: entry to ‘MemoryContextStatsDetail’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:876:9: call_function: calling ‘MemoryContextStatsInternal’ from ‘MemoryContextStatsDetail’
#  957|   
#  958|   	/* Increment the context count for each of the recursive call */
#  959|-> 	*num_contexts = *num_contexts + 1;
#  960|   
#  961|   	/*

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1870:37: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘context’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1436:1: enter_function: entry to ‘ProcessGetMemoryContextInterrupt’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1481:9: call_function: calling ‘compute_contexts_count_and_ids’ from ‘ProcessGetMemoryContextInterrupt’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1481:9: return_function: returning to ‘ProcessGetMemoryContextInterrupt’ from ‘compute_contexts_count_and_ids’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1548:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1563:20: branch_false: ...to here
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1570:12: branch_false: following ‘false’ branch (when ‘summary == 0’)...
 branch_false: ...to here
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1622:9: branch_true: following ‘true’ branch...
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1630:24: call_function: calling ‘compute_context_path’ from ‘ProcessGetMemoryContextInterrupt’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1630:24: return_function: returning to ‘ProcessGetMemoryContextInterrupt’ from ‘compute_context_path’
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1637:20: branch_true: following ‘true’ branch (when ‘context_id <= 1722’)...
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1640:25: branch_true: ...to here
postgresql-18beta1/src/backend/utils/mmgr/mcxt.c:1640:25: call_function: calling ‘PublishMemoryContext’ from ‘ProcessGetMemoryContextInterrupt’
# 1868|   		}
# 1869|   	}
# 1870|-> 	memcxt_info[curr_id].type = context->type;
# 1871|   	memcxt_info[curr_id].totalspace = stat.totalspace;
# 1872|   	memcxt_info[curr_id].nblocks = stat.nblocks;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:727:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:717:12: branch_true: following ‘true’ branch (when ‘fd >= 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:718:22: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:718:22: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:721:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:727:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_lz4.c:727:9: danger: ‘fp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  725|   	}
#  726|   
#  727|-> 	state->fp = fp;
#  728|   
#  729|   	return true;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def20]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: warning[-Wanalyzer-file-leak]: leak of FILE ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: danger: ‘fp’ leaks here; was opened at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  481|   		return false;
#  482|   
#  483|-> 	zstdcs = (ZstdCompressorState *) pg_malloc0(sizeof(*zstdcs));
#  484|   	CFH->private_data = zstdcs;
#  485|   	zstdcs->fp = fp;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_true: following ‘true’ branch (when ‘fd >= 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:476:22: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:476:22: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: danger: ‘fp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  481|   		return false;
#  482|   
#  483|-> 	zstdcs = (ZstdCompressorState *) pg_malloc0(sizeof(*zstdcs));
#  484|   	CFH->private_data = zstdcs;
#  485|   	zstdcs->fp = fp;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def22]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: warning[-Wanalyzer-file-leak]: leak of FILE ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: danger: ‘fp’ leaks here; was opened at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  487|   	if (mode[0] == 'r')
#  488|   	{
#  489|-> 		zstdcs->input.src = pg_malloc0(ZSTD_DStreamInSize());
#  490|   		zstdcs->dstream = ZSTD_createDStream();
#  491|   		if (zstdcs->dstream == NULL)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:489:37: danger: ‘fp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  487|   	if (mode[0] == 'r')
#  488|   	{
#  489|-> 		zstdcs->input.src = pg_malloc0(ZSTD_DStreamInSize());
#  490|   		zstdcs->dstream = ZSTD_createDStream();
#  491|   		if (zstdcs->dstream == NULL)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: warning[-Wanalyzer-file-leak]: leak of FILE ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:18: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:17: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: danger: ‘fp’ leaks here; was opened at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  494|   	else if (mode[0] == 'w' || mode[0] == 'a')
#  495|   	{
#  496|-> 		zstdcs->output.size = ZSTD_CStreamOutSize();
#  497|   		zstdcs->output.dst = pg_malloc0(zstdcs->output.size);
#  498|   		zstdcs->cstream = _ZstdCStreamParams(CFH->compression_spec);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:18: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:17: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:496:39: danger: ‘fp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  494|   	else if (mode[0] == 'w' || mode[0] == 'a')
#  495|   	{
#  496|-> 		zstdcs->output.size = ZSTD_CStreamOutSize();
#  497|   		zstdcs->output.dst = pg_malloc0(zstdcs->output.size);
#  498|   		zstdcs->cstream = _ZstdCStreamParams(CFH->compression_spec);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def26]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:18: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:17: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: danger: ‘fp’ leaks here; was opened at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  501|   	}
#  502|   	else
#  503|-> 		pg_fatal("unhandled mode \"%s\"", mode);
#  504|   
#  505|   	return true;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def27]
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:475:12: branch_false: following ‘false’ branch (when ‘fd < 0’)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:478:22: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:480:12: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:483:42: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:487:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:18: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:494:17: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/compress_zstd.c:503:17: danger: ‘fp’ leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  501|   	}
#  502|   	else
#  503|-> 		pg_fatal("unhandled mode \"%s\"", mode);
#  504|   
#  505|   	return true;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def28]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:25: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
# 1665|   	}
# 1666|   
# 1667|-> 	for (i = 0; i < PQntuples(res); i++)
# 1668|   	{
# 1669|   		char	   *dbname = PQgetvalue(res, i, 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:25: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:25: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
# 1665|   	}
# 1666|   
# 1667|-> 	for (i = 0; i < PQntuples(res); i++)
# 1668|   	{
# 1669|   		char	   *dbname = PQgetvalue(res, i, 0);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def30]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
# 1667|   	for (i = 0; i < PQntuples(res); i++)
# 1668|   	{
# 1669|-> 		char	   *dbname = PQgetvalue(res, i, 0);
# 1670|   		char	   *oid = PQgetvalue(res, i, 1);
# 1671|   		const char *create_opts = "";

Error: GCC_ANALYZER_WARNING (CWE-401): [#def31]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
# 1667|   	for (i = 0; i < PQntuples(res); i++)
# 1668|   	{
# 1669|-> 		char	   *dbname = PQgetvalue(res, i, 0);
# 1670|   		char	   *oid = PQgetvalue(res, i, 1);
# 1671|   		const char *create_opts = "";

Error: GCC_ANALYZER_WARNING (CWE-775): [#def32]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1670:35: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1670:35: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
# 1668|   	{
# 1669|   		char	   *dbname = PQgetvalue(res, i, 0);
# 1670|-> 		char	   *oid = PQgetvalue(res, i, 1);
# 1671|   		const char *create_opts = "";
# 1672|   		int			ret;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def33]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1670:35: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1670:35: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4)
# 1668|   	{
# 1669|   		char	   *dbname = PQgetvalue(res, i, 0);
# 1670|-> 		char	   *oid = PQgetvalue(res, i, 1);
# 1671|   		const char *create_opts = "";
# 1672|   		int			ret;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def34]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/4)
# 1677|   
# 1678|   		/* Skip any explicitly excluded database */
# 1679|-> 		if (simple_string_list_member(&database_exclude_names, dbname))
# 1680|   		{
# 1681|   			pg_log_info("excluding database \"%s\"", dbname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/4)
# 1677|   
# 1678|   		/* Skip any explicitly excluded database */
# 1679|-> 		if (simple_string_list_member(&database_exclude_names, dbname))
# 1680|   		{
# 1681|   			pg_log_info("excluding database \"%s\"", dbname);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def36]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/4)
# 1679|   		if (simple_string_list_member(&database_exclude_names, dbname))
# 1680|   		{
# 1681|-> 			pg_log_info("excluding database \"%s\"", dbname);
# 1682|   			continue;
# 1683|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1681:25: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/4)
# 1679|   		if (simple_string_list_member(&database_exclude_names, dbname))
# 1680|   		{
# 1681|-> 			pg_log_info("excluding database \"%s\"", dbname);
# 1682|   			continue;
# 1683|   		}

Error: GCC_ANALYZER_WARNING (CWE-775): [#def38]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: following ‘true’ branch (when ‘archDumpFormat == 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/4)
# 1690|   		{
# 1691|   			if (archDumpFormat == archCustom)
# 1692|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid);
# 1693|   			else if (archDumpFormat == archTar)
# 1694|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def39]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: following ‘true’ branch (when ‘archDumpFormat == 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1692:33: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/4)
# 1690|   		{
# 1691|   			if (archDumpFormat == archCustom)
# 1692|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid);
# 1693|   			else if (archDumpFormat == archTar)
# 1694|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def40]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_false: following ‘false’ branch (when ‘archDumpFormat != 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_true: following ‘true’ branch (when ‘archDumpFormat == 3’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/4)
# 1692|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid);
# 1693|   			else if (archDumpFormat == archTar)
# 1694|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);
# 1695|   			else
# 1696|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def41]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_false: following ‘false’ branch (when ‘archDumpFormat != 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_true: following ‘true’ branch (when ‘archDumpFormat == 3’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1694:33: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/4)
# 1692|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".dmp", db_subdir, oid);
# 1693|   			else if (archDumpFormat == archTar)
# 1694|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);
# 1695|   			else
# 1696|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def42]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_false: following ‘false’ branch (when ‘archDumpFormat != 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: following ‘false’ branch (when ‘archDumpFormat != 3’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/4)
# 1694|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);
# 1695|   			else
# 1696|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid);
# 1697|   
# 1698|   			/* Put one line entry for dboid and dbname in map file. */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def43]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_false: following ‘false’ branch (when ‘archDumpFormat != 1’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1693:33: branch_false: following ‘false’ branch (when ‘archDumpFormat != 3’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1696:33: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/4)
# 1694|   				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\".tar", db_subdir, oid);
# 1695|   			else
# 1696|-> 				snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid);
# 1697|   
# 1698|   			/* Put one line entry for dboid and dbname in map file. */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def44]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1699:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1699:25: danger: ‘map_file’ leaks here; was opened at [(5)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/4)
# 1697|   
# 1698|   			/* Put one line entry for dboid and dbname in map file. */
# 1699|-> 			fprintf(map_file, "%s %s\n", oid, dbname);
# 1700|   		}
# 1701|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def45]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1699:25: warning[-Wanalyzer-malloc-leak]: leak of ‘map_file’
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1641:12: branch_false: following ‘false’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1653:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1656:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1659:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1662:28: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1663:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1667:21: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1669:38: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1675:20: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:21: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1679:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1689:20: branch_true: following ‘true’ branch (when ‘archDumpFormat != 4’)...
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1691:28: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1699:25: danger: ‘map_file’ leaks here; was allocated at [(5)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/4)
# 1697|   
# 1698|   			/* Put one line entry for dboid and dbname in map file. */
# 1699|-> 			fprintf(map_file, "%s %s\n", oid, dbname);
# 1700|   		}
# 1701|   

Error: CPPCHECK_WARNING (CWE-457): [#def46]
postgresql-18beta1/src/bin/pg_dump/pg_dumpall.c:1977: error[legacyUninitvar]: Uninitialized variable: archDumpFormat
# 1975|   				 format);
# 1976|   
# 1977|-> 	return archDumpFormat;
# 1978|   }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def47]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:869:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  867|   	StringInfoData q;
#  868|   
#  869|-> 	initStringInfo(&q);
#  870|   
#  871|   	resetStringInfo(inBuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:869:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  867|   	StringInfoData q;
#  868|   
#  869|-> 	initStringInfo(&q);
#  870|   
#  871|   	resetStringInfo(inBuf);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def49]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:871:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  869|   	initStringInfo(&q);
#  870|   
#  871|-> 	resetStringInfo(inBuf);
#  872|   
#  873|   	/*

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:871:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  869|   	initStringInfo(&q);
#  870|   
#  871|-> 	resetStringInfo(inBuf);
#  872|   
#  873|   	/*

Error: GCC_ANALYZER_WARNING (CWE-775): [#def51]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:876:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  874|   	 * Read characters until EOF or the appropriate delimiter is seen.
#  875|   	 */
#  876|-> 	while ((c = fgetc(pfile)) != EOF)
#  877|   	{
#  878|   		if (c != '\'' && c != '"' && c != '\n' && c != ';')

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:876:21: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  874|   	 * Read characters until EOF or the appropriate delimiter is seen.
#  875|   	 */
#  876|-> 	while ((c = fgetc(pfile)) != EOF)
#  877|   	{
#  878|   		if (c != '\'' && c != '"' && c != '\n' && c != ';')

Error: GCC_ANALYZER_WARNING (CWE-775): [#def53]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:880:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  878|   		if (c != '\'' && c != '"' && c != '\n' && c != ';')
#  879|   		{
#  880|-> 			appendStringInfoChar(inBuf, (char) c);
#  881|   			while ((c = fgetc(pfile)) != EOF)
#  882|   			{

Error: GCC_ANALYZER_WARNING (CWE-401): [#def54]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:880:25: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  878|   		if (c != '\'' && c != '"' && c != '\n' && c != ';')
#  879|   		{
#  880|-> 			appendStringInfoChar(inBuf, (char) c);
#  881|   			while ((c = fgetc(pfile)) != EOF)
#  882|   			{

Error: GCC_ANALYZER_WARNING (CWE-775): [#def55]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:881:37: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  879|   		{
#  880|   			appendStringInfoChar(inBuf, (char) c);
#  881|-> 			while ((c = fgetc(pfile)) != EOF)
#  882|   			{
#  883|   				if (c != '\'' && c != '"' && c != ';' && c != '\n')

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:881:37: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  879|   		{
#  880|   			appendStringInfoChar(inBuf, (char) c);
#  881|-> 			while ((c = fgetc(pfile)) != EOF)
#  882|   			{
#  883|   				if (c != '\'' && c != '"' && c != ';' && c != '\n')

Error: GCC_ANALYZER_WARNING (CWE-775): [#def57]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:884:41: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  882|   			{
#  883|   				if (c != '\'' && c != '"' && c != ';' && c != '\n')
#  884|-> 					appendStringInfoChar(inBuf, (char) c);
#  885|   				else
#  886|   					break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def58]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:884:41: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1340:16: call_function: calling ‘read_one_statement’ from ‘process_global_sql_commands’
#  882|   			{
#  883|   				if (c != '\'' && c != '"' && c != ';' && c != '\n')
#  884|-> 					appendStringInfoChar(inBuf, (char) c);
#  885|   				else
#  886|   					break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def59]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&map_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1037:1: enter_function: entry to ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: call_function: calling ‘file_exists_in_directory’ from ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: return_function: returning to ‘get_dbname_oid_list_from_mfile’ from ‘file_exists_in_directory’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1055:9: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1058:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1060:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: danger: ‘fopen(&map_file_path, "r")’ leaks here; was opened at [(9)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/8)
# 1061|   		pg_fatal("could not open \"%s\": %m", map_file_path);
# 1062|   
# 1063|-> 	initStringInfo(&linebuf);
# 1064|   
# 1065|   	/* Append all the dbname/db_oid combinations to the list. */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def60]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&map_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1037:1: enter_function: entry to ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: call_function: calling ‘file_exists_in_directory’ from ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: return_function: returning to ‘get_dbname_oid_list_from_mfile’ from ‘file_exists_in_directory’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1055:9: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1058:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1060:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: danger: ‘fopen(&map_file_path, "r")’ leaks here; was allocated at [(9)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/8)
# 1061|   		pg_fatal("could not open \"%s\": %m", map_file_path);
# 1062|   
# 1063|-> 	initStringInfo(&linebuf);
# 1064|   
# 1065|   	/* Append all the dbname/db_oid combinations to the list. */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def61]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1066:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&map_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1037:1: enter_function: entry to ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: call_function: calling ‘file_exists_in_directory’ from ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: return_function: returning to ‘get_dbname_oid_list_from_mfile’ from ‘file_exists_in_directory’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1055:9: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1058:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1060:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1066:16: danger: ‘fopen(&map_file_path, "r")’ leaks here; was opened at [(9)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/8)
# 1064|   
# 1065|   	/* Append all the dbname/db_oid combinations to the list. */
# 1066|-> 	while (pg_get_line_buf(pfile, &linebuf))
# 1067|   	{
# 1068|   		Oid			db_oid = InvalidOid;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1066:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&map_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1037:1: enter_function: entry to ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: call_function: calling ‘file_exists_in_directory’ from ‘get_dbname_oid_list_from_mfile’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:14: return_function: returning to ‘get_dbname_oid_list_from_mfile’ from ‘file_exists_in_directory’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1049:12: branch_true: following ‘true’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1055:9: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1058:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1060:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1063:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1066:16: danger: ‘fopen(&map_file_path, "r")’ leaks here; was allocated at [(9)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/8)
# 1064|   
# 1065|   	/* Append all the dbname/db_oid combinations to the list. */
# 1066|-> 	while (pg_get_line_buf(pfile, &linebuf))
# 1067|   	{
# 1068|   		Oid			db_oid = InvalidOid;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def63]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
# 1328|   
# 1329|   	/* Init sqlstatement to append commands. */
# 1330|-> 	initStringInfo(&sqlstatement);
# 1331|   
# 1332|   	/* creation statement for our current role */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def64]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
# 1328|   
# 1329|   	/* Init sqlstatement to append commands. */
# 1330|-> 	initStringInfo(&sqlstatement);
# 1331|   
# 1332|   	/* creation statement for our current role */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def65]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1333:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1333:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
# 1331|   
# 1332|   	/* creation statement for our current role */
# 1333|-> 	initStringInfo(&user_create);
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def66]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1333:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1333:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
# 1331|   
# 1332|   	/* creation statement for our current role */
# 1333|-> 	initStringInfo(&user_create);
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def67]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1334:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1334:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
# 1332|   	/* creation statement for our current role */
# 1333|   	initStringInfo(&user_create);
# 1334|-> 	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|   	appendStringInfoString(&user_create, PQuser(conn));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def68]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1334:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1334:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
# 1332|   	/* creation statement for our current role */
# 1333|   	initStringInfo(&user_create);
# 1334|-> 	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|   	appendStringInfoString(&user_create, PQuser(conn));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def69]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|-> 	appendStringInfoString(&user_create, PQuser(conn));
# 1337|   	appendStringInfoChar(&user_create, ';');
# 1338|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def70]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|-> 	appendStringInfoString(&user_create, PQuser(conn));
# 1337|   	appendStringInfoChar(&user_create, ';');
# 1338|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def71]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:46: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:46: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/0)
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|-> 	appendStringInfoString(&user_create, PQuser(conn));
# 1337|   	appendStringInfoChar(&user_create, ';');
# 1338|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:46: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1336:46: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/0)
# 1334|   	appendStringInfoString(&user_create, "CREATE ROLE ");
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|-> 	appendStringInfoString(&user_create, PQuser(conn));
# 1337|   	appendStringInfoChar(&user_create, ';');
# 1338|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def73]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1337:9: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1337:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was opened at [(1)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/0)
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|   	appendStringInfoString(&user_create, PQuser(conn));
# 1337|-> 	appendStringInfoChar(&user_create, ';');
# 1338|   
# 1339|   	/* Process file till EOF and execute sql statements. */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def74]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1337:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: following ‘false’ branch (when ‘outfile’ is NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1330:9: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1337:9: danger: ‘fopen(&global_file_path, "r")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/0)
# 1335|   	/* should use fmtId here, but we don't know the encoding */
# 1336|   	appendStringInfoString(&user_create, PQuser(conn));
# 1337|-> 	appendStringInfoChar(&user_create, ';');
# 1338|   
# 1339|   	/* Process file till EOF and execute sql statements. */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def75]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_true: following ‘true’ branch (when ‘outfile’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: call_function: calling ‘copy_or_print_global_file’ from ‘process_global_sql_commands’
# 1388|   	{
# 1389|   		snprintf(out_file_path, MAXPGPATH, "%s", outfile);
# 1390|-> 		OPF = fopen(out_file_path, PG_BINARY_W);
# 1391|   
# 1392|   		if (OPF == NULL)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def76]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_true: following ‘true’ branch (when ‘outfile’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: call_function: calling ‘copy_or_print_global_file’ from ‘process_global_sql_commands’
# 1388|   	{
# 1389|   		snprintf(out_file_path, MAXPGPATH, "%s", outfile);
# 1390|-> 		OPF = fopen(out_file_path, PG_BINARY_W);
# 1391|   
# 1392|   		if (OPF == NULL)

Error: GCC_ANALYZER_WARNING (CWE-775): [#def77]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_true: following ‘true’ branch (when ‘outfile’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: call_function: calling ‘copy_or_print_global_file’ from ‘process_global_sql_commands’
# 1398|   
# 1399|   	/* Append global.dat into output file or print to stdout. */
# 1400|-> 	while ((c = fgetc(pfile)) != EOF)
# 1401|   		fputc(c, OPF);
# 1402|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def78]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(&global_file_path, "r")’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1302:1: enter_function: entry to ‘process_global_sql_commands’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1314:17: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1316:12: branch_false: following ‘false’ branch...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1323:12: branch_true: following ‘true’ branch (when ‘outfile’ is non-NULL)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: branch_true: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1325:17: call_function: calling ‘copy_or_print_global_file’ from ‘process_global_sql_commands’
# 1398|   
# 1399|   	/* Append global.dat into output file or print to stdout. */
# 1400|-> 	while ((c = fgetc(pfile)) != EOF)
# 1401|   		fputc(c, OPF);
# 1402|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def79]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘OPF’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1385:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1389:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1392:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:21: danger: ‘OPF’ leaks here; was opened at [(3)](sarif:/runs/0/results/30/codeFlows/0/threadFlows/0/locations/2)
# 1398|   
# 1399|   	/* Append global.dat into output file or print to stdout. */
# 1400|-> 	while ((c = fgetc(pfile)) != EOF)
# 1401|   		fputc(c, OPF);
# 1402|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def80]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:21: warning[-Wanalyzer-malloc-leak]: leak of ‘OPF’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1385:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1389:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1392:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1400:21: danger: ‘OPF’ leaks here; was allocated at [(3)](sarif:/runs/0/results/31/codeFlows/0/threadFlows/0/locations/2)
# 1398|   
# 1399|   	/* Append global.dat into output file or print to stdout. */
# 1400|-> 	while ((c = fgetc(pfile)) != EOF)
# 1401|   		fputc(c, OPF);
# 1402|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def81]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: warning[-Wanalyzer-file-leak]: leak of FILE ‘OPF’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1385:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1389:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: acquire_resource: opened here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1392:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1406:12: branch_false: following ‘false’ branch (when the strings are equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: danger: ‘OPF’ leaks here; was opened at [(3)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/2)
# 1406|   	if (strcmp(outfile, "-") != 0)
# 1407|   		fclose(OPF);
# 1408|-> }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def82]
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: warning[-Wanalyzer-malloc-leak]: leak of ‘OPF’
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1385:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1389:17: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1390:23: acquire_memory: allocated here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1392:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1406:12: branch_false: following ‘false’ branch (when the strings are equal)...
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: branch_false: ...to here
postgresql-18beta1/src/bin/pg_dump/pg_restore.c:1408:1: danger: ‘OPF’ leaks here; was allocated at [(3)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/2)
# 1406|   	if (strcmp(outfile, "-") != 0)
# 1407|   		fclose(OPF);
# 1408|-> }

Error: CPPCHECK_WARNING (CWE-457): [#def83]
postgresql-18beta1/src/bin/psql/tab-complete.in.c:2555: warning[uninitvar]: Uninitialized variable: argarray
# 2553|   		COMPLETE_WITH("CONSTRAINT", "TO");
# 2554|   	/* ALTER DOMAIN <sth> RENAME CONSTRAINT <sth> */
# 2555|-> 	else if (Matches("ALTER", "DOMAIN", MatchAny, "RENAME", "CONSTRAINT", MatchAny))
# 2556|   		COMPLETE_WITH("TO");
# 2557|   

Error: CPPCHECK_WARNING (CWE-457): [#def84]
postgresql-18beta1/src/bin/psql/tab-complete.in.c:2605: warning[uninitvar]: Uninitialized variable: argarray
# 2603|   		COMPLETE_WITH("TO");
# 2604|   	/* ALTER VIEW xxx RENAME COLUMN yyy */
# 2605|-> 	else if (Matches("ALTER", "VIEW", MatchAny, "RENAME", "COLUMN", MatchAnyExcept("TO")))
# 2606|   		COMPLETE_WITH("TO");
# 2607|   	/* ALTER VIEW xxx RESET ( */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def85]
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:832:38: warning[-Wanalyzer-malloc-leak]: leak of ‘crypt_pwd’
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:806:20: branch_false: following ‘false’ branch...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:811:13: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:824:45: acquire_memory: allocated here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:825:36: branch_false: following ‘false’ branch (when ‘crypt_pwd’ is non-NULL)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:831:33: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:832:38: danger: ‘crypt_pwd’ leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  830|   
#  831|   				crypt_pwd2 = crypt_pwd + MD5_PASSWD_LEN + 1;
#  832|-> 				if (!pg_md5_encrypt(password, conn->pguser,
#  833|   									strlen(conn->pguser), crypt_pwd2,
#  834|   									&errstr))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def86]
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1372:14: warning[-Wanalyzer-malloc-leak]: leak of ‘crypt_pwd’
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1368:21: acquire_memory: allocated here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1369:12: branch_false: following ‘false’ branch (when ‘crypt_pwd’ is non-NULL)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1372:14: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1372:14: danger: ‘crypt_pwd’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
# 1370|   		return NULL;
# 1371|   
# 1372|-> 	if (!pg_md5_encrypt(passwd, user, strlen(user), crypt_pwd, &errstr))
# 1373|   	{
# 1374|   		free(crypt_pwd);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def87]
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1485:30: warning[-Wanalyzer-malloc-leak]: leak of ‘crypt_pwd’
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1413:12: branch_false: following ‘false’ branch (when ‘conn’ is non-NULL)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1416:9: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1419:12: branch_false: following ‘false’ branch (when ‘algorithm’ is non-NULL)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1461:13: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1468:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1478:18: branch_false: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1478:17: branch_true: following ‘true’ branch (when the strings are equal)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1480:29: branch_true: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1480:29: acquire_memory: allocated here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1481:20: branch_true: following ‘true’ branch (when ‘crypt_pwd’ is non-NULL)...
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1483:37: branch_true: ...to here
postgresql-18beta1/src/interfaces/libpq/fe-auth.c:1485:30: danger: ‘crypt_pwd’ leaks here; was allocated at [(9)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/8)
# 1483|   			const char *errstr = NULL;
# 1484|   
# 1485|-> 			if (!pg_md5_encrypt(passwd, user, strlen(user), crypt_pwd, &errstr))
# 1486|   			{
# 1487|   				libpq_append_conn_error(conn, "could not encrypt password: %s", errstr);

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.90.0
diffbase-analyzer-version-cppcheck2.18.3
diffbase-analyzer-version-gcc15.2.1
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-96.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-gcc-latest-x86_64
diffbase-project-namepostgresql18-18.0-1.fc44
diffbase-store-results-to/tmp/tmpcf6xl8i0/postgresql18-18.0-1.fc44.tar.xz
diffbase-time-created2025-10-28 20:19:10
diffbase-time-finished2025-10-28 20:50:18
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpcf6xl8i0/postgresql18-18.0-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpcf6xl8i0/postgresql18-18.0-1.fc44.src.rpm'
diffbase-tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-96.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-gcc-latest-x86_64
project-namepostgresql18-18beta1-4.fc43
store-results-to/tmp/tmpdfdnhfjw/postgresql18-18beta1-4.fc43.tar.xz
time-created2025-10-28 19:46:09
time-finished2025-10-28 20:17:46
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpdfdnhfjw/postgresql18-18beta1-4.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpdfdnhfjw/postgresql18-18beta1-4.fc43.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9