]> git.ipfire.org Git - thirdparty/git.git/blobdiff - ref-filter.c
ref-filter: clear reachable list pointers after freeing
[thirdparty/git.git] / ref-filter.c
index 72175612f3f32f512999099442214339aac948c7..048d277cbf798ea8765e38f89b57a697a9936e61 100644 (file)
@@ -1,12 +1,15 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "alloc.h"
 #include "environment.h"
 #include "gettext.h"
+#include "gpg-interface.h"
 #include "hex.h"
 #include "parse-options.h"
 #include "refs.h"
 #include "wildmatch.h"
+#include "object-name.h"
 #include "object-store.h"
+#include "oid-array.h"
 #include "repository.h"
 #include "commit.h"
 #include "remote.h"
@@ -17,6 +20,7 @@
 #include "revision.h"
 #include "utf8.h"
 #include "version.h"
+#include "versioncmp.h"
 #include "trailer.h"
 #include "wt-status.h"
 #include "commit-slab.h"
@@ -2414,13 +2418,13 @@ void ref_array_clear(struct ref_array *array)
 #define EXCLUDE_REACHED 0
 #define INCLUDE_REACHED 1
 static void reach_filter(struct ref_array *array,
-                        struct commit_list *check_reachable,
+                        struct commit_list **check_reachable,
                         int include_reached)
 {
        int i, old_nr;
        struct commit **to_clear;
 
-       if (!check_reachable)
+       if (!*check_reachable)
                return;
 
        CALLOC_ARRAY(to_clear, array->nr);
@@ -2430,7 +2434,7 @@ static void reach_filter(struct ref_array *array,
        }
 
        tips_reachable_from_bases(the_repository,
-                                 check_reachable,
+                                 *check_reachable,
                                  to_clear, array->nr,
                                  UNINTERESTING);
 
@@ -2451,8 +2455,8 @@ static void reach_filter(struct ref_array *array,
 
        clear_commit_marks_many(old_nr, to_clear, ALL_REV_FLAGS);
 
-       while (check_reachable) {
-               struct commit *merge_commit = pop_commit(&check_reachable);
+       while (*check_reachable) {
+               struct commit *merge_commit = pop_commit(check_reachable);
                clear_commit_marks(merge_commit, ALL_REV_FLAGS);
        }
 
@@ -2549,8 +2553,8 @@ int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int
        clear_contains_cache(&ref_cbdata.no_contains_cache);
 
        /*  Filters that need revision walking */
-       reach_filter(array, filter->reachable_from, INCLUDE_REACHED);
-       reach_filter(array, filter->unreachable_from, EXCLUDE_REACHED);
+       reach_filter(array, &filter->reachable_from, INCLUDE_REACHED);
+       reach_filter(array, &filter->unreachable_from, EXCLUDE_REACHED);
 
        save_commit_buffer = save_commit_buffer_orig;
        return ret;