mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Prevent false positives when freeing a NULL pointer with MALLOC_DEBUG enabled.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@203230 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -157,10 +157,16 @@ static inline size_t __ast_sizeof_region(void *ptr)
|
|||||||
|
|
||||||
static void __ast_free_region(void *ptr, const char *file, int lineno, const char *func)
|
static void __ast_free_region(void *ptr, const char *file, int lineno, const char *func)
|
||||||
{
|
{
|
||||||
int hash = HASH(ptr);
|
int hash;
|
||||||
struct ast_region *reg, *prev = NULL;
|
struct ast_region *reg, *prev = NULL;
|
||||||
unsigned int *fence;
|
unsigned int *fence;
|
||||||
|
|
||||||
|
if (!ptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash = HASH(ptr);
|
||||||
|
|
||||||
ast_mutex_lock(®lock);
|
ast_mutex_lock(®lock);
|
||||||
for (reg = regions[hash]; reg; reg = reg->next) {
|
for (reg = regions[hash]; reg; reg = reg->next) {
|
||||||
if (reg->data == ptr) {
|
if (reg->data == ptr) {
|
||||||
|
Reference in New Issue
Block a user