From 37179a2b1f0a12e063a2bb300e402ac5e7512569 Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Fri, 26 Sep 2014 14:41:38 +0000 Subject: core: Don't allow free to mean ast_free (and malloc, etc..). This gets rid of most old libc free/malloc/realloc and replaces them with ast_free and friends. When compiling with MALLOC_DEBUG you'll notice it when you're mistakenly using one of the libc variants. For the legacy cases you can define WRAP_LIBC_MALLOC before including asterisk.h. Even better would be if the errors were also enabled when compiling without MALLOC_DEBUG, but that's a slightly more invasive header file change. Those compiling addons/format_mp3 will need to rerun ./contrib/scripts/get_mp3_source.sh. ASTERISK-24348 #related Review: https://reviewboard.asterisk.org/r/4015/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423978 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- addons/ooh323c/src/ooCmdChannel.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'addons/ooh323c/src/ooCmdChannel.c') diff --git a/addons/ooh323c/src/ooCmdChannel.c b/addons/ooh323c/src/ooCmdChannel.c index 50a75c2cf..353818d1d 100644 --- a/addons/ooh323c/src/ooCmdChannel.c +++ b/addons/ooh323c/src/ooCmdChannel.c @@ -57,13 +57,13 @@ int ooCreateCallCmdConnection(OOH323CallData* call) OOTRACEINFO2("INFO: create cmd connect for call: %lx\n", call); - call->CmdChanLock = calloc(1, sizeof(ast_mutex_t)); + call->CmdChanLock = ast_calloc(1, sizeof(ast_mutex_t)); ast_mutex_init(call->CmdChanLock); if ((ret = socketpair(PF_LOCAL, SOCK_STREAM, 0, thePipe)) == -1) { ast_mutex_destroy(call->CmdChanLock); - free(call->CmdChanLock); + ast_free(call->CmdChanLock); call->CmdChanLock = NULL; return OO_FAILED; } @@ -94,7 +94,7 @@ int ooCloseCallCmdConnection(OOH323CallData* call) call->CmdChan = 0; ast_mutex_unlock(call->CmdChanLock); ast_mutex_destroy(call->CmdChanLock); - free(call->CmdChanLock); + ast_free(call->CmdChanLock); call->CmdChanLock = NULL; return OO_OK; @@ -267,9 +267,9 @@ int ooReadAndProcessStackCommand() default: OOTRACEERR1("ERROR:Unknown command\n"); } } - if(cmd.param1) free(cmd.param1); - if(cmd.param2) free(cmd.param2); - if(cmd.param3) free(cmd.param3); + ast_free(cmd.param1); + ast_free(cmd.param2); + ast_free(cmd.param3); } @@ -302,7 +302,7 @@ int ooReadAndProcessCallStackCommand(OOH323CallData* call) bPoint += sizeof(OOStackCommand); if (cmd.plen1 > 0) { - cmd.param1 = malloc(cmd.plen1 + 1); + cmd.param1 = ast_malloc(cmd.plen1 + 1); if (!cmd.param1) return OO_FAILED; memset(cmd.param1, 0, cmd.plen1 + 1); @@ -311,7 +311,7 @@ int ooReadAndProcessCallStackCommand(OOH323CallData* call) } if (cmd.plen2 > 0) { - cmd.param2 = malloc(cmd.plen2 + 1); + cmd.param2 = ast_malloc(cmd.plen2 + 1); if (!cmd.param2) return OO_FAILED; memset(cmd.param2, 0, cmd.plen2 + 1); @@ -320,7 +320,7 @@ int ooReadAndProcessCallStackCommand(OOH323CallData* call) } if (cmd.plen3 > 0) { - cmd.param3 = malloc(cmd.plen3 + 1); + cmd.param3 = ast_malloc(cmd.plen3 + 1); if (!cmd.param3) return OO_FAILED; memset(cmd.param3, 0, cmd.plen3 + 1); -- cgit v1.2.3