about summary refs log tree commit diff
path: root/src/locale/iconv_close.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-11-10 15:06:42 -0500
committerRich Felker <dalias@aerifal.cx>2017-11-10 15:06:42 -0500
commit5b546faa67544af395d6407553762b37e9711157 (patch)
tree2dea3ba8d23b5cc6c088a364945985f7b046fa75 /src/locale/iconv_close.c
parent0df5b39a1e9c8aaf480e3f8667d7967e08bbef2b (diff)
downloadmusl-5b546faa67544af395d6407553762b37e9711157.tar.gz
musl-5b546faa67544af395d6407553762b37e9711157.tar.xz
musl-5b546faa67544af395d6407553762b37e9711157.zip
add iconv framework for decoding stateful encodings
assuming pointers obtained from malloc have some nonzero alignment,
repurpose the low bit of iconv_t as an indicator that the descriptor
is a stateless value representing the source and destination character
encodings.
Diffstat (limited to 'src/locale/iconv_close.c')
-rw-r--r--src/locale/iconv_close.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/locale/iconv_close.c b/src/locale/iconv_close.c
index fac681cc..28b29565 100644
--- a/src/locale/iconv_close.c
+++ b/src/locale/iconv_close.c
@@ -1,6 +1,8 @@
 #include <iconv.h>
+#include <stdlib.h>
 
 int iconv_close(iconv_t cd)
 {
+	if (!((size_t)cd & 1)) free((void *)cd);
 	return 0;
 }