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>

Matthew Daley committed Dec 14, 2012 at 02:36 UTC bdd478d620034dc6517aea940f5dc6b88f780c04
1 file changed +3 -3
builtin/pack-redundant.c
+3 -3
@@ -301,14 +301,14 @@ static void pll_free(struct pll *l)
301 */
302 static struct pll * get_permutations(struct pack_list *list, int n)
303 {
304 - struct pll *subset, *ret = NULL, *new_pll = NULL, *pll;
304 + struct pll *subset, *ret = NULL, *new_pll = NULL;
305
306 if (list == NULL || pack_list_size(list) < n || n == 0)
307 return NULL;
308
309 if (n == 1) {
310 while (list) {
311 - new_pll = xmalloc(sizeof(pll));
311 + new_pll = xmalloc(sizeof(*new_pll));
312 new_pll->pl = NULL;
313 pack_list_insert(&new_pll->pl, list);
314 new_pll->next = ret;
@@ -321,7 +321,7 @@ static struct pll * get_permutations(struct pack_list *list, int n)
321 while (list->next) {
322 subset = get_permutations(list->next, n - 1);
323 while (subset) {
324 - new_pll = xmalloc(sizeof(pll));
324 + new_pll = xmalloc(sizeof(*new_pll));
325 new_pll->pl = subset->pl;
326 pack_list_insert(&new_pll->pl, list);
327 new_pll->next = ret;