Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
apply: free unused fragments for submodule patch
author
Junio C Hamano
<gitster@pobox.com>
Thu, 29 Mar 2012 06:22:22 +0000
(23:22 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 29 Mar 2012 06:27:00 +0000
(23:27 -0700)
We simply discarded the fragments that we are not going to use upon seeing
a patch to update the submodule commit bound at path that we have not
checked out.
Free these fragments, not to leak them.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8192a2f
)
diff --git
a/builtin/apply.c
b/builtin/apply.c
index c65fb3f8dad04b22f5357e019eb87fa4d0d47bfe..9491d38abab4ef11f225e0ca9380d6f5fe44ac1e 100644
(file)
--- a/
builtin/apply.c
+++ b/
builtin/apply.c
@@
-196,17
+196,20
@@
struct patch {
struct patch *next;
};
struct patch *next;
};
-static void free_
patch(struct patch *patch
)
+static void free_
fragment_list(struct fragment *list
)
{
{
- struct fragment *fragment = patch->fragments;
-
- while (fragment) {
- struct fragment *fragment_next = fragment->next;
- if (fragment->patch != NULL && fragment->free_patch)
- free((char *)fragment->patch);
- free(fragment);
- fragment = fragment_next;
+ while (list) {
+ struct fragment *next = list->next;
+ if (list->free_patch)
+ free((char *)list->patch);
+ free(list);
+ list = next;
}
}
+}
+
+static void free_patch(struct patch *patch)
+{
+ free_fragment_list(patch->fragments);
free(patch->def_name);
free(patch->old_name);
free(patch->new_name);
free(patch->def_name);
free(patch->old_name);
free(patch->new_name);
@@
-2992,7
+2995,10
@@
static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
/*
* There is no way to apply subproject
* patch without looking at the index.
/*
* There is no way to apply subproject
* patch without looking at the index.
+ * NEEDSWORK: shouldn't this be flagged
+ * as an error???
*/
*/
+ free_fragment_list(patch->fragments);
patch->fragments = NULL;
}
} else {
patch->fragments = NULL;
}
} else {