aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asterisk/frame.h16
-rw-r--r--main/frame.c4
2 files changed, 14 insertions, 6 deletions
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index bc7273a09..4cc0cd576 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -31,6 +31,8 @@ extern "C" {
#include <sys/types.h>
#include <sys/time.h>
+
+#include "asterisk/compiler.h"
#include "asterisk/endian.h"
#include "asterisk/linkedlists.h"
@@ -354,12 +356,18 @@ struct ast_option_header {
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
diff --git a/main/frame.c b/main/frame.c
index ba47f7308..17da73f4c 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -317,12 +317,12 @@ static void frame_cache_cleanup(void *data)
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;