]> git.ozlabs.org Git - ccan/blobdiff - ccan/alloc/alloc.c
alloc: fix uninitialized entry (thanks valgrind!)
[ccan] / 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);
        }