Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 May 2023 21:38:51 +0200
From: Jens Gustedt <>
Subject: [C23 new stdlib 1/4] C23: add the new interfaces free_sized and free_aligned_sized for stdlib.h

For the moment, these are just trivial wrappers that ignored their
parameters other than the pointer.

The names were not previously reserved, so they could generate naming
conflicts with application code.

The "implementation" is just a trivial wrapper around free. This could
eventually replaced by implementations that are more efficient than
 include/stdlib.h  |  2 ++
 src/malloc/free.c | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/stdlib.h b/include/stdlib.h
index 8a873f03..7800074d 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -41,6 +41,8 @@ void *malloc (size_t);
 void *calloc (size_t, size_t);
 void *realloc (void *, size_t);
 void free (void *);
+void free_sized (void *, size_t);
+void free_aligned_sized (void *, size_t, size_t);
 void *aligned_alloc(size_t, size_t);
 __noreturn void abort (void);
diff --git a/src/malloc/free.c b/src/malloc/free.c
index 3944f7b2..2b7438bc 100644
--- a/src/malloc/free.c
+++ b/src/malloc/free.c
@@ -4,3 +4,13 @@ void free(void *p)
+void free_sized (void *p, size_t size)
+	__libc_free(p);
+void free_aligned_sized (void *p, size_t alignment, size_t size)
+	__libc_free(p);

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.