diff --git a/config.subr b/config.subr
index 591d814..0259b5c 100644
--- a/config.subr
+++ b/config.subr
@@ -176,7 +176,11 @@ config_asan() {
OUT=".config_$NAME"
echo "/* generated by configure */" > "$OUT_C"
echo "#include <stdlib.h>" >> "$OUT_C"
- echo "int main (void) { (void) malloc(1); return 0; }" >> "$OUT_C"
+ echo "int main (void) {" >> "$OUT_C"
+ echo " void *x = malloc(1);" >> "$OUT_C"
+ echo " free(x);" >> "$OUT_C"
+ echo " return 0;" >> "$OUT_C"
+ echo "}" >> "$OUT_C"
if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} \
-fsanitize=address -fno-omit-frame-pointer \
"$OUT_C" ${LIBS} -lasan -o "$OUT"; then