public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] hugemmap24: Postpone free()
@ 2024-01-30  9:28 Petr Vorel
  2024-01-30 12:42 ` Avinesh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-01-30  9:28 UTC (permalink / raw)
  To: ltp

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(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
index 431dc1bbf..3ba0985dc 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap24.c
@@ -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)
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH 1/1] hugemmap24: Postpone free()
  2024-01-30  9:28 [LTP] [PATCH 1/1] hugemmap24: Postpone free() Petr Vorel
@ 2024-01-30 12:42 ` Avinesh Kumar
  2024-01-31 18:09   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Avinesh Kumar @ 2024-01-30 12:42 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

Reviewed-by: Avinesh Kumar <akumar@suse.de>

Regards,
Avinesh



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH 1/1] hugemmap24: Postpone free()
  2024-01-30 12:42 ` Avinesh Kumar
@ 2024-01-31 18:09   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2024-01-31 18:09 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

thanks, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-31 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30  9:28 [LTP] [PATCH 1/1] hugemmap24: Postpone free() Petr Vorel
2024-01-30 12:42 ` Avinesh Kumar
2024-01-31 18:09   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox