@@ -42,7 +42,6 @@ static int init_slice_boundary(int fd)
/* dummy malloc so we know where is heap */
heap = malloc(1);
- free(heap);
/* Avoid underflow on systems with large huge pages.
* The additionally plus heap address is to reduce the possibility
@@ -51,6 +50,8 @@ static int init_slice_boundary(int fd)
while (slice_boundary + slice_size < (unsigned long)heap + 2*hpage_size)
slice_boundary += slice_size;
+ free(heap);
+
/* Find 2 neighbour slices with couple huge pages free
* around slice boundary.
* 16 is the maximum number of slices (low/high)
This fixes warning: pointer ‘heap’ used after ‘free’. Pointer is not used anyway, but better to avoid warning. Signed-off-by: Petr Vorel <pvorel@suse.cz> --- testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)