}
ast_mutex_unlock(®lock);
if (!reg) {
- fprintf(stderr, "Memory allocation failure\n");
+ fprintf(stderr, "Memory Allocation Failure - '%d' bytes in function %s at line %d of %s\n", (int) size, func, lineno, file);
if (mmlog) {
- fprintf(mmlog, "%ld - Memory allocation failure\n", time(NULL));
+ fprintf(stderr, "%ld - Memory Allocation Failure - '%d' bytes in function %s at line %d of %s\n", time(NULL), (int) size, func, lineno, file);
fflush(mmlog);
}
}
long int ast_random(void);
#endif
+#ifndef __AST_DEBUG_MALLOC
+
/*!
\brief A wrapper for malloc()
}
)
+#else
+
+/* If astmm is in use, let it handle these. Otherwise, it will report that
+ all allocations are coming from this header file */
+
+#define ast_malloc(a) malloc(a)
+#define ast_calloc(a,b) calloc(a,b)
+#define ast_realloc(a,b) realloc(a,b)
+#define ast_strdup(a) strdup(a)
+#define ast_strndup(a,b) strndup(a,b)
+
+#endif /* AST_DEBUG_MALLOC */
+
#if !defined(ast_strdupa) && defined(__GNUC__)
/*!
\brief duplicate a string in memory from the stack