Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/fsck.c3
-rw-r--r--object-file.c5
-rwxr-xr-xt/t1050-large.sh8
3 files changed, 12 insertions, 4 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d87c28a1cc..27b9e78094 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -605,7 +605,7 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
struct object *obj;
enum object_type type = OBJ_NONE;
unsigned long size;
- void *contents;
+ void *contents = NULL;
int eaten;
struct object_info oi = OBJECT_INFO_INIT;
struct object_id real_oid = *null_oid();
@@ -630,6 +630,7 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
path);
if (err < 0) {
errors_found |= ERROR_OBJECT;
+ free(contents);
return 0; /* keep checking other objects */
}
diff --git a/object-file.c b/object-file.c
index 02b7970274..c3d866a287 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2557,10 +2557,9 @@ int read_loose_object(const char *path,
goto out;
}
if (check_object_signature(the_repository, expected_oid,
- *contents, *size, oi->type_name->buf, real_oid)) {
- free(*contents);
+ *contents, *size,
+ oi->type_name->buf, real_oid))
goto out;
- }
}
ret = 0; /* everything checks out */
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 4bab6a513c..6bc1d76fb1 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -17,6 +17,14 @@ test_expect_success setup '
export GIT_ALLOC_LIMIT
'
+test_expect_success 'enter "large" codepath, with small core.bigFileThreshold' '
+ test_when_finished "rm -rf repo" &&
+
+ git init --bare repo &&
+ echo large | git -C repo hash-object -w --stdin &&
+ git -C repo -c core.bigfilethreshold=4 fsck
+'
+
# add a large file with different settings
while read expect config
do