X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=shallow.c;h=91b9e1073c9fb8427c42eb8a638e628f4a13c22a;hb=dfc7f65c261e923a41c910a11390d487e66eb6fe;hp=b826de9b676c1c0d61fb30638284ed32c0f8403e;hpb=e7ae437ac19eb0e82739d82cc886221252689ff4;p=thirdparty%2Fgit.git diff --git a/shallow.c b/shallow.c index b826de9b67..91b9e1073c 100644 --- a/shallow.c +++ b/shallow.c @@ -110,6 +110,10 @@ void rollback_shallow_file(struct repository *r, struct shallow_lock *lk) * supports a "valid" flag. */ define_commit_slab(commit_depth, int *); +static void free_depth_in_slab(int **ptr) +{ + FREE_AND_NULL(*ptr); +} struct commit_list *get_shallow_commits(struct object_array *heads, int depth, int shallow_flag, int not_shallow_flag) { @@ -176,15 +180,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, } } } - for (i = 0; i < depths.slab_count; i++) { - int j; - - if (!depths.slab[i]) - continue; - for (j = 0; j < depths.slab_size; j++) - free(depths.slab[i][j]); - } - clear_commit_depth(&depths); + deep_clear_commit_depth(&depths, free_depth_in_slab); return result; }