Code

http-walker: cleanup more thoroughly
[git.git] / http-walker.c
index 700bc13112d65dfe8cf89af17522e28cf0d76e26..508e35517c55b8b9f894c46a25e831f1ed3652b9 100644 (file)
@@ -543,6 +543,23 @@ static int fetch_ref(struct walker *walker, struct ref *ref)
 
 static void cleanup(struct walker *walker)
 {
+       struct walker_data *data = walker->data;
+       struct alt_base *alt, *alt_next;
+
+       if (data) {
+               alt = data->alt;
+               while (alt) {
+                       alt_next = alt->next;
+
+                       free(alt->base);
+                       free(alt);
+
+                       alt = alt_next;
+               }
+               free(data);
+               walker->data = NULL;
+       }
+
        http_cleanup();
 }