diff --git a/changes/bug20424_029_minimal b/changes/bug20424_029_minimal
new file mode 100644
index 0000000000000000000000000000000000000000..eb7886233efc9fbd5121da291554d77505fc6a04
--- /dev/null
+++ b/changes/bug20424_029_minimal
@@ -0,0 +1,4 @@
+  o Minor bugfixes (compilation):
+    - When compiling with --enable-openbsd-malloc or --enable-tcmalloc, tell
+      the compiler not to include the system malloc implementation. Fixes bug
+      20424; bugfix on 0.2.0.20-rc.
diff --git a/configure.ac b/configure.ac
index 32eed75bf93833f92baa96b4671667a0561a4014..ebd41537421400fd68e99bba4603f0f1890474f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1807,6 +1807,10 @@ fi
 if test "$using_custom_malloc" = "no"; then
    AC_CHECK_FUNCS(mallinfo)
 fi
+if test "$using_custom_malloc" = "yes"; then
+  # Tell the C compiler not to use the system allocator functions.
+  TOR_CHECK_CFLAGS([-fno-builtin-malloc -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-free])
+fi
 
 # By default, we're going to assume we don't have mlockall()
 # bionic and other platforms have various broken mlockall subsystems.