Skip to content

Commit ddb3c85

Browse files
auselengitster
authored andcommitted
shallow.c: don't free unallocated slabs
Fix possible segfault when cloning a submodule shallow. Signed-off-by: Ali Utku Selen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98cdfbb commit ddb3c85

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

shallow.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
148148
for (i = 0; i < depths.slab_count; i++) {
149149
int j;
150150

151+
if (!depths.slab[i])
152+
continue;
151153
for (j = 0; j < depths.slab_size; j++)
152154
free(depths.slab[i][j]);
153155
}

0 commit comments

Comments
 (0)