From 038082c425c40037a28111934dfb5037edbcad8c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 29 Apr 2020 19:08:19 +0000 Subject: Fix alloc_realloc UB void ** does not exist: the address of a generic pointer is not properly defined (different pointer types may have different representations). So, alloc_realloc cannot exist as is without UB. Fortunately, it's not supposed to be used in the skalibs programming style, and skalibs itself only uses it in two places (stralloc_ready_tuned and stralloc_shrink) where the pointer is a char *. So we just fix the UB by making alloc_realloc() take a char **, and it's only defined for that pointer type. Nothing to see here folks, nothing happened at all. --- src/include/skalibs/alloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/skalibs/alloc.h b/src/include/skalibs/alloc.h index a1afdce..642dc65 100644 --- a/src/include/skalibs/alloc.h +++ b/src/include/skalibs/alloc.h @@ -10,6 +10,6 @@ extern void *alloc (size_t) ; #define alloc_free(p) free(p) #define alloc_re(p, old, new) alloc_realloc(p, new) -extern int alloc_realloc (void **, size_t) ; +extern int alloc_realloc (char **, size_t) ; #endif -- cgit v1.2.3