Index: include/asterisk/frame.h
===================================================================
--- include/asterisk/frame.h (revision 41930)
+++ include/asterisk/frame.h (working copy)
@@ -31,6 +31,8 @@
#include <sys/types.h>
#include <sys/time.h>
+
+#include "asterisk/compiler.h"
#include "asterisk/endian.h"
#include "asterisk/linkedlists.h"
@@ -354,13 +356,19 @@
struct ast_frame *ast_fralloc(char *source, int len);
#endif
-/*! \brief Frees a frame
+/*!
+ * \brief Frees a frame
+ *
* \param fr Frame to free
- * Free a frame, and the memory it used if applicable
- * \return no return.
+ * \param cache Whether to consider this frame for frame caching
*/
-void ast_frfree(struct ast_frame *fr);
+void ast_frame_free(struct ast_frame *fr, int cache);
+static void force_inline ast_frfree(struct ast_frame *fr)
+{
+ ast_frame_free(fr, 1);
+}
+
/*! \brief Makes a frame independent of any static storage
* \param fr frame to act upon
* Take a frame, and if it's not been malloc'd, make a malloc'd copy
Index: main/frame.c
===================================================================
--- main/frame.c (revision 41930)
+++ main/frame.c (working copy)
@@ -317,12 +317,12 @@
free(frames);
}
-void ast_frfree(struct ast_frame *fr)
+void ast_frame_free(struct ast_frame *fr, int cache)
{
if (!fr->mallocd)
return;
- if (fr->mallocd == AST_MALLOCD_HDR) {
+ if (cache && fr->mallocd == AST_MALLOCD_HDR) {
/* Cool, only the header is malloc'd, let's just cache those for now
* to keep things simple... */
struct ast_frame_cache *frames;