[ccan] [PATCH] talloc: avoid a comparison mismatch & at the same time switch to non-legacy sysconf()

Cody P Schafer dev at codyps.com
Mon Aug 17 08:58:32 AEST 2015


Without this, gcc warns about a sign mismatch in the comparison.

Signed-off-by: Cody P Schafer <dev at codyps.com>
---
 ccan/talloc/talloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ccan/talloc/talloc.c b/ccan/talloc/talloc.c
index 0c6bcda..3ada60f 100644
--- a/ccan/talloc/talloc.c
+++ b/ccan/talloc/talloc.c
@@ -810,7 +810,7 @@ void *_talloc(const void *context, size_t size)
 
 static int talloc_destroy_pointer(void ***pptr)
 {
-	if ((uintptr_t)**pptr < getpagesize())
+	if ((uintptr_t)**pptr < (uintptr_t)sysconf(_SC_PAGESIZE))
 		TALLOC_ABORT("Double free or invalid talloc_set?");
 	/* Invalidate pointer so it can't be used again. */
 	**pptr = (void *)1;
-- 
2.5.0



More information about the ccan mailing list