summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/checkout.c1
-rw-r--r--src/diff_patch.c3
-rw-r--r--src/index.c3
-rw-r--r--src/openssl_stream.c3
-rw-r--r--src/pathspec.c6
-rw-r--r--src/repository.c2
6 files changed, 16 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 73750f7f6..52a076da6 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -2212,6 +2212,7 @@ static void checkout_data_clear(checkout_data *data)
git__free(data->pfx);
data->pfx = NULL;
+ git_buf_free(&data->last_mkdir);
git_buf_free(&data->path);
git_buf_free(&data->tmp);
diff --git a/src/diff_patch.c b/src/diff_patch.c
index 3129d06e1..a15107753 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -823,7 +823,8 @@ int git_patch__invoke_callbacks(
for (i = 0; !error && i < git_array_size(patch->hunks); ++i) {
diff_patch_hunk *h = git_array_get(patch->hunks, i);
- error = hunk_cb(patch->delta, &h->hunk, payload);
+ if (hunk_cb)
+ error = hunk_cb(patch->delta, &h->hunk, payload);
if (!line_cb)
continue;
diff --git a/src/index.c b/src/index.c
index 079b0cb65..cbace3606 100644
--- a/src/index.c
+++ b/src/index.c
@@ -292,6 +292,9 @@ static void index_entry_reuc_free(git_index_reuc_entry *reuc)
static void index_entry_free(git_index_entry *entry)
{
+ if (!entry)
+ return;
+
memset(&entry->id, 0, sizeof(entry->id));
git__free(entry);
}
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index 3a6369dee..2a17a3abf 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -12,6 +12,9 @@
#include <openssl/x509v3.h>
#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include "global.h"
#include "posix.h"
diff --git a/src/pathspec.c b/src/pathspec.c
index 8b469f717..fab6f9a76 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -296,6 +296,9 @@ int git_pathspec_matches_path(
static void pathspec_match_free(git_pathspec_match_list *m)
{
+ if (!m)
+ return;
+
git_pathspec_free(m->pathspec);
m->pathspec = NULL;
@@ -315,6 +318,9 @@ static git_pathspec_match_list *pathspec_match_alloc(
m = NULL;
}
+ if (!m)
+ return NULL;
+
/* need to keep reference to pathspec and increment refcount because
* failures array stores pointers to the pattern strings of the
* pathspec that had no matches
diff --git a/src/repository.c b/src/repository.c
index 30f0cd0f2..d87ce730a 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1723,7 +1723,7 @@ int git_repository_set_bare(git_repository *repo)
if ((error = git_repository_config__weakptr(&config, repo)) < 0)
return error;
- if ((error = git_config_set_bool(config, "core.bare", false)) < 0)
+ if ((error = git_config_set_bool(config, "core.bare", true)) < 0)
return error;
if ((error = git_config__update_entry(config, "core.worktree", NULL, true, true)) < 0)