diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index 1cb37d1acea03d93bc071fa9aac414c5335f75d3..1a5f4d9f86e873ffb3758aca75bd035030bd3421 100644
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -959,13 +959,17 @@ struct iax_frame *iax_frame_new(int direction, int datalen, unsigned int cacheab
 		}
 		AST_LIST_TRAVERSE_SAFE_END
 	}
-#endif
-
 	if (!fr) {
 		if (!(fr = ast_calloc_cache(1, sizeof(*fr) + datalen)))
 			return NULL;
 		fr->mallocd_datalen = datalen;
 	}
+#else
+	if (!(fr = ast_calloc(1, sizeof(*fr) + datalen)))
+		return NULL;
+	fr->mallocd_datalen = datalen;
+#endif
+
 
 	fr->direction = direction;
 	fr->retrans = -1;
diff --git a/main/frame.c b/main/frame.c
index f8935db5c6f026a9750b32e57802565c3f922f07..39ba8cdadb1c69236518ffd4c864b36314f43d7c 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -304,10 +304,12 @@ static struct ast_frame *ast_frame_header_new(void)
 			return f;
 		}
 	}
-#endif
-
 	if (!(f = ast_calloc_cache(1, sizeof(*f))))
 		return NULL;
+#else
+	if (!(f = ast_calloc(1, sizeof(*f))))
+		return NULL;
+#endif
 
 	f->mallocd_hdr_len = sizeof(*f);
 #ifdef TRACE_FRAMES