mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
Merge pull request #7154 from ShiningMassXAcc/fix-C4703
Fix C4703 uninitialized pointer variable warnings
This commit is contained in:
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"sarif-viewer.connectToGithubCodeScanning": "off"
|
||||
}
|
||||
@@ -340,7 +340,7 @@ int git_commit_amend(
|
||||
{
|
||||
git_repository *repo;
|
||||
git_oid tree_id;
|
||||
git_reference *ref;
|
||||
git_reference *ref = NULL;
|
||||
int error;
|
||||
|
||||
GIT_ASSERT_ARG(id);
|
||||
|
||||
@@ -106,7 +106,7 @@ static int fetchhead_ref_write(
|
||||
git_fetchhead_ref *fetchhead_ref)
|
||||
{
|
||||
char oid[GIT_OID_MAX_HEXSIZE + 1];
|
||||
const char *type, *name;
|
||||
const char *type = NULL, *name = NULL;
|
||||
int head = 0;
|
||||
|
||||
GIT_ASSERT_ARG(file);
|
||||
|
||||
@@ -2510,7 +2510,7 @@ static int read_entry(
|
||||
{
|
||||
size_t path_length, path_offset, entry_size;
|
||||
const char *path_ptr;
|
||||
struct entry_common *source_common;
|
||||
struct entry_common *source_common = NULL;
|
||||
index_entry_short_sha1 source_sha1;
|
||||
#ifdef GIT_EXPERIMENTAL_SHA256
|
||||
index_entry_short_sha256 source_sha256;
|
||||
@@ -2862,7 +2862,7 @@ static int write_disk_entry(
|
||||
const char *last)
|
||||
{
|
||||
void *mem = NULL;
|
||||
struct entry_common *ondisk_common;
|
||||
struct entry_common *ondisk_common = NULL;
|
||||
size_t path_len, path_offset, disk_size;
|
||||
int varint_len = 0;
|
||||
char *path;
|
||||
@@ -2951,7 +2951,7 @@ static int write_disk_entry(
|
||||
path_offset = index_entry_path_offset(index->oid_type, entry->flags);
|
||||
|
||||
if (entry->flags & GIT_INDEX_ENTRY_EXTENDED) {
|
||||
struct entry_common *ondisk_ext;
|
||||
struct entry_common *ondisk_ext = NULL;
|
||||
uint16_t flags_extended = htons(entry->flags_extended &
|
||||
GIT_INDEX_ENTRY_EXTENDED_FLAGS);
|
||||
|
||||
|
||||
@@ -936,7 +936,7 @@ static int merge_conflict_resolve_contents(
|
||||
git_merge_file_result result = {0};
|
||||
git_merge_driver *driver;
|
||||
git_merge_driver__builtin builtin = {{0}};
|
||||
git_index_entry *merge_result;
|
||||
git_index_entry *merge_result = NULL;
|
||||
git_odb *odb = NULL;
|
||||
const char *name;
|
||||
bool fallback = false;
|
||||
|
||||
@@ -682,7 +682,7 @@ static int validate_ownership_path(bool *is_safe, const char *path)
|
||||
|
||||
static int validate_ownership(git_repository *repo)
|
||||
{
|
||||
const char *validation_paths[3] = { NULL }, *path;
|
||||
const char *validation_paths[3] = { NULL }, *path = NULL;
|
||||
size_t validation_len = 0, i;
|
||||
bool is_safe = false;
|
||||
int error = 0;
|
||||
@@ -1448,7 +1448,7 @@ int git_repository_config__weakptr(git_config **out, git_repository *repo)
|
||||
git_str xdg_buf = GIT_STR_INIT;
|
||||
git_str programdata_buf = GIT_STR_INIT;
|
||||
bool use_env = repo->use_env;
|
||||
git_config *config;
|
||||
git_config *config = NULL;
|
||||
|
||||
if (!(error = config_path_system(&system_buf, use_env)) &&
|
||||
!(error = config_path_global(&global_buf, use_env))) {
|
||||
|
||||
@@ -553,7 +553,7 @@ static int apply_credentials(
|
||||
{
|
||||
git_http_auth_context *auth = server->auth_context;
|
||||
git_vector *challenges = &server->auth_challenges;
|
||||
const char *challenge;
|
||||
const char *challenge = NULL;
|
||||
git_str token = GIT_STR_INIT;
|
||||
int error = 0;
|
||||
|
||||
|
||||
@@ -184,8 +184,8 @@ static int url_parse_authority(
|
||||
const char *authority,
|
||||
size_t len)
|
||||
{
|
||||
const char *c, *hostport_end, *host_end = NULL,
|
||||
*userpass_end, *user_end = NULL;
|
||||
const char *c, *hostport_end = NULL, *host_end = NULL,
|
||||
*userpass_end = NULL, *user_end = NULL;
|
||||
|
||||
enum {
|
||||
HOSTPORT, HOST, IPV6, HOST_END, USERPASS, USER
|
||||
@@ -464,7 +464,7 @@ done:
|
||||
int git_net_url_parse(git_net_url *url, const char *given)
|
||||
{
|
||||
git_net_url_parser parser = GIT_NET_URL_PARSER_INIT;
|
||||
const char *c, *authority, *path;
|
||||
const char *c, *authority = NULL, *path = NULL;
|
||||
size_t authority_len = 0, path_len = 0;
|
||||
int error = 0;
|
||||
|
||||
@@ -574,7 +574,7 @@ int git_net_url_parse_http(
|
||||
const char *given)
|
||||
{
|
||||
git_net_url_parser parser = GIT_NET_URL_PARSER_INIT;
|
||||
const char *c, *authority, *path = NULL;
|
||||
const char *c = NULL, *authority = NULL, *path = NULL;
|
||||
size_t authority_len = 0, path_len = 0;
|
||||
int error;
|
||||
|
||||
@@ -661,7 +661,7 @@ static bool has_at(const char *str)
|
||||
int git_net_url_parse_scp(git_net_url *url, const char *given)
|
||||
{
|
||||
const char *default_port = default_port_for_scheme("ssh");
|
||||
const char *c, *user, *host, *port = NULL, *path = NULL;
|
||||
const char *c, *user = NULL, *host = NULL, *port = NULL, *path = NULL;
|
||||
size_t user_len = 0, host_len = 0, port_len = 0;
|
||||
unsigned short bracket = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user