]> git.ozlabs.org Git - ccan/commitdiff
alloc: fix uninitialized entry (thanks valgrind!)
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 25 Sep 2010 12:34:16 +0000 (22:04 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Sat, 25 Sep 2010 12:34:16 +0000 (22:04 +0930)
ccan/alloc/alloc.c

index 8e0b72aa0432227990f7b053f6620020fd53dcac..6cd96d8d8a3681713273f3ed45f8bcea59f49281 100644 (file)
@@ -489,6 +489,8 @@ static unsigned long break_up_large_page(struct header *head,
 
        for (i = 1; i < SMALL_PAGES_PER_LARGE_PAGE; i++) {
                struct page_header *ph = from_pgnum(head, lpage + i, sp_bits);
+               /* Initialize this: huge_alloc reads it. */
+               ph->elements_used = 0;
                add_small_page_to_freelist(head, ph, sp_bits);
        }