summaryrefslogtreecommitdiff
path: root/builtin/pack-redundant.c
diff options
context:
space:
mode:
authorMatthew Daley <mattjd@gmail.com>2012-12-13 13:36:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-13 19:13:44 (GMT)
commitbdd478d620034dc6517aea940f5dc6b88f780c04 (patch)
tree85d0bc53838a77d4160a1efa70d118bcc3bb2537 /builtin/pack-redundant.c
parent75940a001acb0c09abea8ac71ed1568ab125c795 (diff)
downloadgit-bdd478d620034dc6517aea940f5dc6b88f780c04.zip
git-bdd478d620034dc6517aea940f5dc6b88f780c04.tar.gz
git-bdd478d620034dc6517aea940f5dc6b88f780c04.tar.bz2
Fix sizeof usage in get_permutations
Currently it gets the size of an otherwise unrelated, unused variable instead of the expected struct size. Signed-off-by: Matthew Daley <mattjd@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-redundant.c')
-rw-r--r--builtin/pack-redundant.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index f5c6afc..649c3aa 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -301,14 +301,14 @@ static void pll_free(struct pll *l)
*/
static struct pll * get_permutations(struct pack_list *list, int n)
{
- struct pll *subset, *ret = NULL, *new_pll = NULL, *pll;
+ struct pll *subset, *ret = NULL, *new_pll = NULL;
if (list == NULL || pack_list_size(list) < n || n == 0)
return NULL;
if (n == 1) {
while (list) {
- new_pll = xmalloc(sizeof(pll));
+ new_pll = xmalloc(sizeof(*new_pll));
new_pll->pl = NULL;
pack_list_insert(&new_pll->pl, list);
new_pll->next = ret;
@@ -321,7 +321,7 @@ static struct pll * get_permutations(struct pack_list *list, int n)
while (list->next) {
subset = get_permutations(list->next, n - 1);
while (subset) {
- new_pll = xmalloc(sizeof(pll));
+ new_pll = xmalloc(sizeof(*new_pll));
new_pll->pl = subset->pl;
pack_list_insert(&new_pll->pl, list);
new_pll->next = ret;