[svn-commits] wdoekes: trunk r423978 - in /trunk: addons/ addons/ooh323c/src/ apps/ cel/ ch...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Sep 26 09:41:56 CDT 2014
Author: wdoekes
Date: Fri Sep 26 09:41:38 2014
New Revision: 423978
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=423978
Log:
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/
Modified:
trunk/addons/app_mysql.c
trunk/addons/chan_ooh323.c
trunk/addons/ooh323c/src/context.c
trunk/addons/ooh323c/src/errmgmt.c
trunk/addons/ooh323c/src/memheap.c
trunk/addons/ooh323c/src/ooCalls.c
trunk/addons/ooh323c/src/ooCmdChannel.c
trunk/addons/ooh323c/src/ooStackCmds.c
trunk/addons/ooh323c/src/oochannels.c
trunk/addons/ooh323c/src/printHandler.c
trunk/addons/ooh323cDriver.c
trunk/apps/app_jack.c
trunk/apps/app_queue.c
trunk/cel/cel_tds.c
trunk/channels/chan_console.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_skinny.c
trunk/contrib/scripts/get_mp3_source.sh
trunk/funcs/func_curl.c
trunk/include/asterisk/astmm.h
trunk/main/abstract_jb.c
trunk/main/acl.c
trunk/main/app.c
trunk/main/ast_expr2.c
trunk/main/ast_expr2.y
trunk/main/ast_expr2f.c
trunk/main/autoservice.c
trunk/main/file.c
trunk/main/hashtab.c
trunk/main/loader.c
trunk/main/tdd.c
trunk/pbx/pbx_config.c
trunk/res/ael/ael.flex
trunk/res/ael/ael.tab.c
trunk/res/ael/ael.y
trunk/res/ael/ael_lex.c
trunk/res/ael/pval.c
trunk/res/res_config_ldap.c
trunk/res/res_phoneprov.c
trunk/res/res_pktccops.c
trunk/res/res_rtp_asterisk.c
trunk/res/res_smdi.c
trunk/tests/test_dlinklists.c
trunk/utils/extconf.c
Modified: trunk/addons/app_mysql.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/app_mysql.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/app_mysql.c (original)
+++ trunk/addons/app_mysql.c Fri Sep 26 09:41:38 2014
@@ -218,7 +218,7 @@
ast_log(LOG_WARNING, "Unable to lock identifiers list\n");
return -1;
} else {
- i = malloc(sizeof(*i));
+ i = ast_malloc(sizeof(*i));
AST_LIST_TRAVERSE(headp, j, entries) {
if (j->identifier > maxidentifier) {
maxidentifier = j->identifier;
@@ -247,7 +247,7 @@
if ((i->identifier == identifier) &&
(i->identifier_type == identifier_type)) {
AST_LIST_REMOVE(headp, i, entries);
- free(i);
+ ast_free(i);
found = 1;
break;
}
Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Fri Sep 26 09:41:38 2014
@@ -538,7 +538,7 @@
pvt->call_reference = callref;
if (callToken)
- pvt->callToken = strdup(callToken);
+ pvt->callToken = ast_strdup(callToken);
/* whether to use gk for this call */
if (gRasGkMode == RasNoGatekeeper)
@@ -645,8 +645,8 @@
}
if (peer) {
- p->username = strdup(peer->name);
- p->host = strdup(peer->ip);
+ p->username = ast_strdup(peer->name);
+ p->host = ast_strdup(peer->ip);
p->port = peer->port;
/* Disable gk as we are going to call a known peer*/
/* OO_SETFLAG(p->flags, H323_DISABLEGK); */
@@ -707,9 +707,9 @@
p->directrtp = gDirectRTP;
p->earlydirect = gEarlyDirect;
- p->username = strdup(dest);
-
- p->host = strdup(dest);
+ p->username = ast_strdup(dest);
+
+ p->host = ast_strdup(dest);
if (port > 0) {
p->port = port;
}
@@ -964,22 +964,22 @@
ast_mutex_lock(&p->lock);
ast_set_flag(p, H323_OUTGOING);
if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) {
- free(p->callerid_num);
- p->callerid_num = strdup(ast_channel_connected(ast)->id.number.str);
+ ast_free(p->callerid_num);
+ p->callerid_num = ast_strdup(ast_channel_connected(ast)->id.number.str);
}
if (ast_channel_connected(ast)->id.name.valid && ast_channel_connected(ast)->id.name.str) {
- free(p->callerid_name);
- p->callerid_name = strdup(ast_channel_connected(ast)->id.name.str);
+ ast_free(p->callerid_name);
+ p->callerid_name = ast_strdup(ast_channel_connected(ast)->id.name.str);
} else if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) {
- free(p->callerid_name);
- p->callerid_name = strdup(ast_channel_connected(ast)->id.number.str);
+ ast_free(p->callerid_name);
+ p->callerid_name = ast_strdup(ast_channel_connected(ast)->id.number.str);
} else {
ast_channel_connected(ast)->id.name.valid = 1;
- free(ast_channel_connected(ast)->id.name.str);
- ast_channel_connected(ast)->id.name.str = strdup(gCallerID);
- free(p->callerid_name);
- p->callerid_name = strdup(ast_channel_connected(ast)->id.name.str);
+ ast_free(ast_channel_connected(ast)->id.name.str);
+ ast_channel_connected(ast)->id.name.str = ast_strdup(gCallerID);
+ ast_free(p->callerid_name);
+ p->callerid_name = ast_strdup(ast_channel_connected(ast)->id.name.str);
}
/* Retrieve vars */
@@ -992,7 +992,7 @@
if ((val = pbx_builtin_getvar_helper(ast, "CALLER_H323DIALEDDIGITS"))) {
ast_copy_string(p->caller_dialedDigits, val, sizeof(p->caller_dialedDigits));
if(!p->callerid_num)
- p->callerid_num = strdup(val);
+ p->callerid_num = ast_strdup(val);
}
if ((val = pbx_builtin_getvar_helper(ast, "CALLER_H323EMAIL"))) {
@@ -1113,7 +1113,7 @@
if (p) {
ast_mutex_lock(&p->lock);
- callToken = (p->callToken ? strdup(p->callToken) : NULL);
+ callToken = (p->callToken ? ast_strdup(p->callToken) : NULL);
if (ast_channel_state(ast) != AST_STATE_UP) {
ast_channel_lock(ast);
if (!p->alertsent) {
@@ -1132,7 +1132,7 @@
ooAnswerCall(p->callToken);
}
if (callToken) {
- free(callToken);
+ ast_free(callToken);
}
ast_mutex_unlock(&p->lock);
}
@@ -1239,7 +1239,7 @@
if (!p) return -1;
ast_mutex_lock(&p->lock);
- callToken = (p->callToken ? strdup(p->callToken) : NULL);
+ callToken = (p->callToken ? ast_strdup(p->callToken) : NULL);
ast_mutex_unlock(&p->lock);
if (!callToken) {
@@ -1409,7 +1409,7 @@
ast_verb(0, "++++ ooh323_indicate %d on %s is %d\n", condition, callToken, res);
}
- free(callToken);
+ ast_free(callToken);
return res;
}
@@ -1815,25 +1815,25 @@
if (call->remoteDisplayName) {
- p->callerid_name = strdup(call->remoteDisplayName);
+ p->callerid_name = ast_strdup(call->remoteDisplayName);
}
if (ooCallGetCallingPartyNumber(call, number, OO_MAX_NUMBER_LENGTH) == OO_OK) {
- p->callerid_num = strdup(number);
+ p->callerid_num = ast_strdup(number);
}
if (call->remoteAliases) {
for (alias = call->remoteAliases; alias; alias = alias->next) {
if (alias->type == T_H225AliasAddress_h323_ID) {
if (!p->callerid_name) {
- p->callerid_name = strdup(alias->value);
+ p->callerid_name = ast_strdup(alias->value);
}
ast_copy_string(p->caller_h323id, alias->value, sizeof(p->caller_h323id));
}
else if(alias->type == T_H225AliasAddress_dialedDigits)
{
if(!p->callerid_num)
- p->callerid_num = strdup(alias->value);
+ p->callerid_num = ast_strdup(alias->value);
ast_copy_string(p->caller_dialedDigits, alias->value,
sizeof(p->caller_dialedDigits));
}
@@ -1874,7 +1874,7 @@
user = find_user(p->callerid_name, call->remoteIP);
if(user && (user->incominglimit == 0 || user->inUse < user->incominglimit)) {
ast_mutex_lock(&user->lock);
- p->username = strdup(user->name);
+ p->username = ast_strdup(user->name);
p->neighbor.user = user->mUseIP ? ast_strdup(user->mIP) :
ast_strdup(user->name);
ast_copy_string(p->context, user->context, sizeof(p->context));
@@ -1920,7 +1920,7 @@
ast_mutex_unlock(&user->lock);
} else {
if (!OO_TESTFLAG(p->flags,H323_DISABLEGK)) {
- p->username = strdup(call->remoteIP);
+ p->username = ast_strdup(call->remoteIP);
p->directrtp = gDirectRTP;
p->earlydirect = gEarlyDirect;
} else {
@@ -2273,7 +2273,7 @@
}
ast_mutex_unlock(&userl.lock);
- free(user);
+ ast_free(user);
}
if (gH323Debug)
@@ -2305,13 +2305,13 @@
}
ast_mutex_unlock(&peerl.lock);
- if(peer->h323id) free(peer->h323id);
- if(peer->email) free(peer->email);
- if(peer->url) free(peer->url);
- if(peer->e164) free(peer->e164);
-
- ao2_cleanup(peer->cap);
- free(peer);
+ ast_free(peer->h323id);
+ ast_free(peer->email);
+ ast_free(peer->url);
+ ast_free(peer->e164);
+
+ ao2_cleanup(peer->cap);
+ ast_free(peer);
}
if (gH323Debug)
@@ -2797,8 +2797,8 @@
while (cur) {
prev = cur;
cur = cur->next;
- free(prev->value);
- free(prev);
+ ast_free(prev->value);
+ ast_free(prev);
}
gAliasList = NULL;
ooH323EpClearAllAliases();
@@ -2913,7 +2913,7 @@
ast_copy_string(gCallerID, v->value, sizeof(gCallerID));
}
pNewAlias->type = T_H225AliasAddress_h323_ID;
- pNewAlias->value = strdup(v->value);
+ pNewAlias->value = ast_strdup(v->value);
pNewAlias->next = gAliasList;
gAliasList = pNewAlias;
pNewAlias = NULL;
@@ -2934,7 +2934,7 @@
return 1;
}
pNewAlias->type = T_H225AliasAddress_dialedDigits;
- pNewAlias->value = strdup(v->value);
+ pNewAlias->value = ast_strdup(v->value);
pNewAlias->next = gAliasList;
gAliasList = pNewAlias;
pNewAlias = NULL;
@@ -2949,7 +2949,7 @@
return 1;
}
pNewAlias->type = T_H225AliasAddress_email_ID;
- pNewAlias->value = strdup(v->value);
+ pNewAlias->value = ast_strdup(v->value);
pNewAlias->next = gAliasList;
gAliasList = pNewAlias;
pNewAlias = NULL;
@@ -4094,22 +4094,22 @@
}
if (cur->username) {
- free(cur->username);
+ ast_free(cur->username);
cur->username = 0;
}
if (cur->host) {
- free(cur->host);
+ ast_free(cur->host);
cur->host = 0;
}
if (cur->callerid_name) {
- free(cur->callerid_name);
+ ast_free(cur->callerid_name);
cur->callerid_name = 0;
}
if (cur->callerid_num) {
- free(cur->callerid_num);
+ ast_free(cur->callerid_num);
cur->callerid_num = 0;
}
@@ -4151,7 +4151,7 @@
user->inUse--;
ast_mutex_unlock(&user->lock);
}
- free(cur->neighbor.user);
+ ast_free(cur->neighbor.user);
}
} else {
/* outgoing limit decrement here !!! */
@@ -4181,10 +4181,10 @@
cur = cur->next;
ast_mutex_destroy(&prev->lock);
- if(prev->h323id) free(prev->h323id);
- if(prev->email) free(prev->email);
- if(prev->url) free(prev->url);
- if(prev->e164) free(prev->e164);
+ ast_free(prev->h323id);
+ ast_free(prev->email);
+ ast_free(prev->url);
+ ast_free(prev->e164);
if(prev->rtpmask) {
ast_mutex_lock(&prev->rtpmask->lock);
prev->rtpmask->inuse--;
@@ -4192,10 +4192,10 @@
if (prev->rtpmask->inuse == 0) {
regfree(&prev->rtpmask->regex);
ast_mutex_destroy(&prev->rtpmask->lock);
- free(prev->rtpmask);
+ ast_free(prev->rtpmask);
}
}
- free(prev);
+ ast_free(prev);
if (cur == peerl.peers) {
break;
@@ -4223,11 +4223,11 @@
if (prev->rtpmask->inuse == 0) {
regfree(&prev->rtpmask->regex);
ast_mutex_destroy(&prev->rtpmask->lock);
- free(prev->rtpmask);
+ ast_free(prev->rtpmask);
}
}
ao2_cleanup(prev->cap);
- free(prev);
+ ast_free(prev);
if (cur == userl.users) {
break;
}
@@ -4339,8 +4339,8 @@
while (cur) {
prev = cur;
cur = cur->next;
- free(prev->value);
- free(prev);
+ ast_free(prev->value);
+ ast_free(prev);
}
gAliasList = NULL;
@@ -4504,7 +4504,7 @@
memset(&p->redirip, 0, sizeof(p->redirip));
}
- callToken = (p->callToken ? strdup(p->callToken) : NULL);
+ callToken = (p->callToken ? ast_strdup(p->callToken) : NULL);
if (!callToken) {
if (gH323Debug) {
@@ -4532,7 +4532,7 @@
}
ast_mutex_unlock(&p->lock);
- free(callToken);
+ ast_free(callToken);
return 0;
}
Modified: trunk/addons/ooh323c/src/context.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/context.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/context.c (original)
+++ trunk/addons/ooh323c/src/context.c Fri Sep 26 09:41:38 2014
@@ -15,6 +15,7 @@
*****************************************************************************/
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
#include "ooasn1.h"
#include <stdlib.h>
@@ -157,11 +158,11 @@
OOCTXT* newContext ()
{
/* OOCTXT* pctxt = (OOCTXT*) ASN1CRTMALLOC0 (sizeof(OOCTXT)); */
- OOCTXT* pctxt = (OOCTXT*) malloc (sizeof(OOCTXT));
+ OOCTXT* pctxt = ast_malloc(sizeof(OOCTXT));
if (pctxt) {
if (initContext(pctxt) != ASN_OK) {
/* ASN1CRTFREE0 (pctxt); */
- free(pctxt);
+ ast_free(pctxt);
pctxt = 0;
}
pctxt->flags |= ASN1DYNCTXT;
Modified: trunk/addons/ooh323c/src/errmgmt.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/errmgmt.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/errmgmt.c (original)
+++ trunk/addons/ooh323c/src/errmgmt.c Fri Sep 26 09:41:38 2014
@@ -18,6 +18,7 @@
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
#include <stdlib.h>
#include "ooasn1.h"
@@ -89,7 +90,7 @@
#if defined(_NO_THREADS) || !defined(_NO_MALLOC)
if (pErrInfo->parmcnt < ASN_K_MAXERRP) {
/* char* tmpstr = (char*) ASN1CRTMALLOC0 (strlen(errprm_p)+1); */
- char* tmpstr = (char*) malloc (strlen(errprm_p)+1);
+ char* tmpstr = ast_malloc(strlen(errprm_p) + 1);
strcpy (tmpstr, errprm_p);
pErrInfo->parms[pErrInfo->parmcnt] = tmpstr;
pErrInfo->parmcnt++;
@@ -118,7 +119,7 @@
for (i = 0; i < pErrInfo->parmcnt; i++)
/* ASN1CRTFREE0 ((char*)pErrInfo->parms[i]); */
- free ((char*)pErrInfo->parms[i]);
+ ast_free((char*)pErrInfo->parms[i]);
#endif
pErrInfo->parmcnt = 0;
Modified: trunk/addons/ooh323c/src/memheap.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/memheap.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/memheap.c (original)
+++ trunk/addons/ooh323c/src/memheap.c Fri Sep 26 09:41:38 2014
@@ -15,6 +15,7 @@
*****************************************************************************/
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
#include <stdlib.h>
#include "memheap.h"
@@ -176,13 +177,13 @@
/* allocate raw block */
- data = malloc (nbytes);
+ data = ast_malloc(nbytes);
if (data == NULL) {
return NULL;
}
pMemLink = memHeapAddBlock (ppMemLink, data, RTMEMMALLOC | RTMEMRAW);
if (pMemLink == 0) {
- free (data);
+ ast_free(data);
return NULL;
}
/* save size of the RAW memory block behind the pMemLink */
@@ -333,7 +334,7 @@
((((ASN1UINT)dataUnits) * 8u) + sizeof (OSMemBlk));
}
- pmem = (ASN1OCTET*) malloc (allocSize + sizeof (OSMemLink));
+ pmem = (ASN1OCTET*) ast_malloc(allocSize + sizeof (OSMemLink));
if (0 != pmem) {
OSMemElemDescr* pElem;
@@ -357,7 +358,7 @@
if (memHeapAddBlock (ppMemLink, pMemBlk, RTMEMSTD | RTMEMLINK) == 0)
{
- free (pmem);
+ ast_free(pmem);
ast_mutex_unlock(&pMemHeap->pLock);
return NULL;
}
@@ -437,12 +438,12 @@
if ((pMemLink->blockType & RTMEMLINK) &&
(pMemLink->blockType & RTMEMMALLOC))
{
- free (pMemLink);
+ ast_free(pMemLink);
}
else {
if (pMemLink->blockType & RTMEMMALLOC)
- free (pMemLink->pMemBlk);
- free (pMemLink);
+ ast_free(pMemLink->pMemBlk);
+ ast_free(pMemLink);
}
ast_mutex_unlock(&pMemHeap->pLock);
return;
@@ -553,11 +554,11 @@
FILLFREEMEM (pMemBlk->plink, sizeof (*pMemBlk->plink));
FILLFREEMEM (pMemBlk->data, (pMemBlk->nunits * 8u));
- free (pMemBlk->plink);
+ ast_free(pMemBlk->plink);
if (!(blockType & RTMEMLINK)) {
FILLFREEMEM (pMemBlk, sizeof (*pMemBlk));
- free (pMemBlk);
+ ast_free(pMemBlk);
}
RTMEMDIAG2 ("memHeapFreePtr: pMemBlk = 0x%x was freed\n",
pMemBlk);
@@ -748,7 +749,7 @@
pMemLink->pMemBlk == mem_p)
{
if (pMemLink->blockType & RTMEMMALLOC) {
- void *newMemBlk = realloc (pMemLink->pMemBlk, nbytes_);
+ void *newMemBlk = ast_realloc(pMemLink->pMemBlk, nbytes_);
if (newMemBlk == 0)
return 0;
pMemLink->pMemBlk = newMemBlk;
@@ -1038,8 +1039,8 @@
if (((pMemLink2->blockType & RTMEMSTD) ||
(pMemLink2->blockType & RTMEMMALLOC)) &&
!(pMemLink2->blockType & RTMEMLINK))
- free (pMemLink2->pMemBlk);
- free (pMemLink2);
+ ast_free(pMemLink2->pMemBlk);
+ ast_free(pMemLink2);
}
}
ast_mutex_unlock(&pMemHeap->pLock);
@@ -1075,12 +1076,12 @@
pMemLink2 = pMemLink;
pMemLink = pMemLink2->pnext;
- free (pMemLink2);
+ ast_free(pMemLink2);
}
if ((*ppMemHeap)->flags & RT_MH_FREEHEAPDESC) {
ast_mutex_destroy(&pMemHeap->pLock);
- free (*ppMemHeap);
+ ast_free(*ppMemHeap);
}
*ppMemHeap = 0;
}
@@ -1215,8 +1216,7 @@
if (blockType & RTMEMLINK)
pMemLink = (OSMemLink*) (((ASN1OCTET*)pMemBlk) - sizeof (OSMemLink));
else {
- pMemLink = (OSMemLink*) malloc (
- sizeof(OSMemLink) + sizeof (int));
+ pMemLink = ast_malloc(sizeof(OSMemLink) + sizeof(int));
if (pMemLink == 0) return 0;
/* An extra integer is necessary to save a size of a RAW memory block
to perform rtMemRealloc through malloc/memcpy/free */
@@ -1339,7 +1339,7 @@
OSMemHeap* pMemHeap;
if (ppvMemHeap == 0) return ASN_E_INVPARAM;
- pMemHeap = (OSMemHeap*) malloc (sizeof (OSMemHeap));
+ pMemHeap = ast_malloc(sizeof (OSMemHeap));
if (pMemHeap == NULL) return ASN_E_NOMEM;
memset (pMemHeap, 0, sizeof (OSMemHeap));
pMemHeap->defBlkSize = g_defBlkSize;
Modified: trunk/addons/ooh323c/src/ooCalls.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooCalls.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/ooCalls.c (original)
+++ trunk/addons/ooh323c/src/ooCalls.c Fri Sep 26 09:41:38 2014
@@ -16,6 +16,7 @@
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
#include "ootrace.h"
#include "ootypes.h"
@@ -366,13 +367,13 @@
if ((call->rtpMask->inuse) == 0) {
regfree(&call->rtpMask->regex);
ast_mutex_destroy(&call->rtpMask->lock);
- free(call->rtpMask);
+ ast_free(call->rtpMask);
}
}
if ((pctxt = call->msgctxt) != NULL) {
freeContext(pctxt);
- free(pctxt);
+ ast_free(pctxt);
call->msgctxt = NULL;
}
/* May !!!! Fix it !! */
Modified: trunk/addons/ooh323c/src/ooCmdChannel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooCmdChannel.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/ooCmdChannel.c (original)
+++ trunk/addons/ooh323c/src/ooCmdChannel.c Fri Sep 26 09:41:38 2014
@@ -57,13 +57,13 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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);
Modified: trunk/addons/ooh323c/src/ooStackCmds.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooStackCmds.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/ooStackCmds.c (original)
+++ trunk/addons/ooh323c/src/ooStackCmds.c Fri Sep 26 09:41:38 2014
@@ -79,7 +79,7 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_MAKECALL;
- cmd.param1 = (void*) malloc(strlen(dest)+1);
+ cmd.param1 = ast_malloc(strlen(dest)+1);
if(!cmd.param1)
{
return OO_STKCMD_MEMERR;
@@ -87,10 +87,10 @@
strcpy((char*)cmd.param1, dest);
- cmd.param2 = (void*) malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(strlen(callToken)+1);
if(!cmd.param2)
{
- free(cmd.param1);
+ ast_free(cmd.param1);
return OO_STKCMD_MEMERR;
}
@@ -101,11 +101,11 @@
cmd.param3 = 0;
}
else {
- cmd.param3 = (void*) malloc(sizeof(ooCallOptions));
+ cmd.param3 = ast_malloc(sizeof(ooCallOptions));
if(!cmd.param3)
{
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
memcpy((void*)cmd.param3, opts, sizeof(ooCallOptions));
@@ -113,9 +113,9 @@
if(ooWriteStackCommand(&cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- if(cmd.param3) free(cmd.param3);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ if(cmd.param3) ast_free(cmd.param3);
return OO_STKCMD_WRITEERR;
}
@@ -149,7 +149,7 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_MAKECALL;
- cmd.param1 = (void*) malloc(strlen(dest)+1);
+ cmd.param1 = ast_malloc(strlen(dest)+1);
if(!cmd.param1)
{
return OO_STKCMD_MEMERR;
@@ -158,10 +158,10 @@
cmd.plen1 = strlen(dest);
- cmd.param2 = (void*) malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(strlen(callToken)+1);
if(!cmd.param2)
{
- free(cmd.param1);
+ ast_free(cmd.param1);
return OO_STKCMD_MEMERR;
}
@@ -173,11 +173,11 @@
cmd.param3 = 0;
}
else {
- cmd.param3 = (void*) malloc(sizeof(ooCallOptions));
+ cmd.param3 = ast_malloc(sizeof(ooCallOptions));
if(!cmd.param3)
{
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
memcpy((void*)cmd.param3, opts, sizeof(ooCallOptions));
@@ -186,16 +186,16 @@
if(ooWriteCallStackCommand(call, &cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- if(cmd.param3) free(cmd.param3);
- return OO_STKCMD_WRITEERR;
- }
-
-
- free(cmd.param1);
- free(cmd.param2);
- if(cmd.param3) free(cmd.param3);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ if(cmd.param3) ast_free(cmd.param3);
+ return OO_STKCMD_WRITEERR;
+ }
+
+
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ if(cmd.param3) ast_free(cmd.param3);
return OO_STKCMD_SUCCESS;
}
@@ -223,7 +223,7 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_MANUALRINGBACK;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
if(!cmd.param1)
{
return OO_STKCMD_MEMERR;
@@ -233,11 +233,11 @@
if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
{
- free(cmd.param1);
- return OO_STKCMD_WRITEERR;
- }
-
- free(cmd.param1);
+ ast_free(cmd.param1);
+ return OO_STKCMD_WRITEERR;
+ }
+
+ ast_free(cmd.param1);
return OO_STKCMD_SUCCESS;
}
@@ -267,7 +267,7 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_MANUALPROGRESS;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
if(!cmd.param1)
{
return OO_STKCMD_MEMERR;
@@ -277,11 +277,11 @@
if(ooWriteCallStackCommand(call, &cmd) != OO_OK)
{
- free(cmd.param1);
- return OO_STKCMD_WRITEERR;
- }
-
- free(cmd.param1);
+ ast_free(cmd.param1);
+ return OO_STKCMD_WRITEERR;
+ }
+
+ ast_free(cmd.param1);
return OO_STKCMD_SUCCESS;
}
@@ -309,7 +309,7 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_ANSCALL;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
if(!cmd.param1)
{
return OO_STKCMD_MEMERR;
@@ -319,11 +319,11 @@
if(ooWriteCallStackCommand(call, &cmd) != OO_OK)
{
- free(cmd.param1);
- return OO_STKCMD_WRITEERR;
- }
-
- free(cmd.param1);
+ ast_free(cmd.param1);
+ return OO_STKCMD_WRITEERR;
+ }
+
+ ast_free(cmd.param1);
return OO_STKCMD_SUCCESS;
}
@@ -350,12 +350,12 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_FWDCALL;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
- cmd.param2 = (void*) malloc(strlen(dest)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(strlen(dest)+1);
if(!cmd.param1 || !cmd.param2)
{
- if(cmd.param1) free(cmd.param1); /* Release memory */
- if(cmd.param2) free(cmd.param2);
+ if(cmd.param1) ast_free(cmd.param1); /* Release memory */
+ if(cmd.param2) ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
@@ -365,12 +365,12 @@
if(ooWriteCallStackCommand(call, &cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- return OO_STKCMD_WRITEERR;
- }
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ return OO_STKCMD_WRITEERR;
+ }
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_SUCCESS;
}
@@ -399,14 +399,14 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_HANGCALL;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
- cmd.param2 = (void*) malloc(sizeof(OOCallClearReason));
- cmd.param3 = (void*) malloc(sizeof(int));
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(sizeof(OOCallClearReason));
+ cmd.param3 = ast_malloc(sizeof(int));
if(!cmd.param1 || !cmd.param2 || !cmd.param3)
{
- if(cmd.param1) free(cmd.param1); /* Release memory */
- if(cmd.param2) free(cmd.param2);
- if(cmd.param3) free(cmd.param3);
+ if(cmd.param1) ast_free(cmd.param1); /* Release memory */
+ if(cmd.param2) ast_free(cmd.param2);
+ if(cmd.param3) ast_free(cmd.param3);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
@@ -418,14 +418,14 @@
if(ooWriteCallStackCommand(call, &cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- free(cmd.param3);
- return OO_STKCMD_WRITEERR;
- }
- free(cmd.param1);
- free(cmd.param2);
- free(cmd.param3);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ ast_free(cmd.param3);
+ return OO_STKCMD_WRITEERR;
+ }
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ ast_free(cmd.param3);
return OO_STKCMD_SUCCESS;
}
@@ -473,12 +473,12 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_SENDDIGIT;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
- cmd.param2 = (void*) malloc(strlen(dtmf)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(strlen(dtmf)+1);
if(!cmd.param1 || !cmd.param2)
{
- if(cmd.param1) free(cmd.param1); /* Release memory */
- if(cmd.param2) free(cmd.param2);
+ if(cmd.param1) ast_free(cmd.param1); /* Release memory */
+ if(cmd.param2) ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
@@ -488,12 +488,12 @@
if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- return OO_STKCMD_WRITEERR;
- }
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ return OO_STKCMD_WRITEERR;
+ }
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_SUCCESS;
}
@@ -521,12 +521,12 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_SETANI;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
- cmd.param2 = (void*) malloc(strlen(ani)+1);
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(strlen(ani)+1);
if(!cmd.param1 || !cmd.param2)
{
- if(cmd.param1) free(cmd.param1); /* Release memory */
- if(cmd.param2) free(cmd.param2);
+ if(cmd.param1) ast_free(cmd.param1); /* Release memory */
+ if(cmd.param2) ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
@@ -536,12 +536,12 @@
if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- return OO_STKCMD_WRITEERR;
- }
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ return OO_STKCMD_WRITEERR;
+ }
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_SUCCESS;
}
@@ -631,12 +631,12 @@
memset(&cmd, 0, sizeof(OOStackCommand));
cmd.type = OO_CMD_REQMODE;
- cmd.param1 = (void*) malloc(strlen(callToken)+1);
- cmd.param2 = (void*) malloc(sizeof(int));
+ cmd.param1 = ast_malloc(strlen(callToken)+1);
+ cmd.param2 = ast_malloc(sizeof(int));
if(!cmd.param1 || !cmd.param2)
{
- if(cmd.param1) free(cmd.param1); /* Release memory */
- if(cmd.param2) free(cmd.param2);
+ ast_free(cmd.param1); /* Release memory */
+ ast_free(cmd.param2);
return OO_STKCMD_MEMERR;
}
strcpy((char*)cmd.param1, callToken);
@@ -646,12 +646,12 @@
if(ooWriteCallStackCommand(call,&cmd) != OO_OK)
{
- free(cmd.param1);
- free(cmd.param2);
- return OO_STKCMD_WRITEERR;
- }
- free(cmd.param1);
- free(cmd.param2);
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
+ return OO_STKCMD_WRITEERR;
+ }
+ ast_free(cmd.param1);
+ ast_free(cmd.param2);
return OO_STKCMD_SUCCESS;
}
Modified: trunk/addons/ooh323c/src/oochannels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/oochannels.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/oochannels.c (original)
+++ trunk/addons/ooh323c/src/oochannels.c Fri Sep 26 09:41:38 2014
@@ -961,7 +961,7 @@
ast_cond_destroy(&call->gkWait);
pctxt = call->pctxt;
freeContext(pctxt);
- free(pctxt);
+ ast_free(pctxt);
return OO_OK;
}
Modified: trunk/addons/ooh323c/src/printHandler.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/printHandler.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323c/src/printHandler.c (original)
+++ trunk/addons/ooh323c/src/printHandler.c Fri Sep 26 09:41:38 2014
@@ -19,6 +19,7 @@
*/
#include "asterisk.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
#include <stdlib.h>
/* #ifdef HAVE_MALLOC_H
@@ -126,10 +127,10 @@
indent ();
OOTRACEDBGB2("%s\n", bitStrToString (numbits, data, s, numbits+8));
#else
- char* s = (char*)malloc(numbits + 8);
+ char* s = ast_malloc(numbits + 8);
indent ();
OOTRACEDBGB2("%s\n", bitStrToString (numbits, data, s, numbits+8));
- free(s);
+ ast_free(s);
#endif
}
@@ -141,10 +142,10 @@
indent ();
OOTRACEDBGB2 ("%s\n", octStrToString (numocts, data, s, bufsiz));
#else
- char* s = (char*)malloc(bufsiz);
+ char* s = ast_malloc(bufsiz);
indent ();
OOTRACEDBGB2 ("%s\n", octStrToString (numocts, data, s, bufsiz));
- free(s);
+ ast_free(s);
#endif
}
Modified: trunk/addons/ooh323cDriver.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323cDriver.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/addons/ooh323cDriver.c (original)
+++ trunk/addons/ooh323cDriver.c Fri Sep 26 09:41:38 2014
@@ -121,7 +121,7 @@
close(mycthread->thePipe[0]);
close(mycthread->thePipe[1]);
- free(mycthread);
+ ast_free(mycthread);
ast_module_unref(myself);
ast_update_use_count();
return NULL;
@@ -155,7 +155,7 @@
ast_module_ref(myself);
if ((socketpair(PF_LOCAL, SOCK_STREAM, 0, cur->thePipe)) == -1) {
ast_log(LOG_ERROR, "Can't create thread pipe for call %s\n", call->callToken);
- free(cur);
+ ast_free(cur);
return -1;
}
cur->inUse = TRUE;
@@ -173,7 +173,7 @@
ast_mutex_destroy(&cur->lock);
close(cur->thePipe[0]);
close(cur->thePipe[1]);
- free(cur);
+ ast_free(cur);
return -1;
}
Modified: trunk/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_jack.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Fri Sep 26 09:41:38 2014
@@ -497,7 +497,7 @@
jack_port_name(jack_data->output_port));
}
- free((void *) ports);
+ jack_free(ports);
break;
}
@@ -528,7 +528,7 @@
jack_port_name(jack_data->input_port));
}
- free((void *) ports);
+ jack_free(ports);
break;
}
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Sep 26 09:41:38 2014
@@ -3232,7 +3232,7 @@
ast_string_field_free_memory(q);
for (i = 0; i < MAX_PERIODIC_ANNOUNCEMENTS; i++) {
if (q->sound_periodicannounce[i]) {
- free(q->sound_periodicannounce[i]);
+ ast_free(q->sound_periodicannounce[i]);
}
}
ao2_ref(q->members, -1);
Modified: trunk/cel/cel_tds.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cel/cel_tds.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/cel/cel_tds.c (original)
+++ trunk/cel/cel_tds.c Fri Sep 26 09:41:38 2014
@@ -240,21 +240,21 @@
done:
ast_mutex_unlock(&tds_lock);
- free(accountcode_ai);
- free(clidnum_ai);
- free(clid_ai);
- free(cidani_ai);
- free(cidrdnis_ai);
- free(ciddnid_ai);
- free(exten_ai);
- free(context_ai);
- free(channel_ai);
- free(app_ai);
- free(appdata_ai);
- free(uniqueid_ai);
- free(linkedid_ai);
- free(userfield_ai);
- free(peer_ai);
+ ast_free(accountcode_ai);
+ ast_free(clidnum_ai);
+ ast_free(clid_ai);
+ ast_free(cidani_ai);
+ ast_free(cidrdnis_ai);
+ ast_free(ciddnid_ai);
+ ast_free(exten_ai);
+ ast_free(context_ai);
+ ast_free(channel_ai);
+ ast_free(app_ai);
+ ast_free(appdata_ai);
+ ast_free(uniqueid_ai);
+ ast_free(linkedid_ai);
+ ast_free(userfield_ai);
+ ast_free(peer_ai);
return;
}
@@ -317,11 +317,11 @@
va_end(ap);
if (dbfcmd(dbproc, buffer) == FAIL) {
- free(buffer);
+ ast_free(buffer);
return 1;
}
- free(buffer);
+ ast_free(buffer);
if (dbsqlexec(dbproc) == FAIL) {
return 1;
Modified: trunk/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_console.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/channels/chan_console.c (original)
+++ trunk/channels/chan_console.c Fri Sep 26 09:41:38 2014
@@ -860,7 +860,7 @@
} else
ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
- free(s);
+ ast_free(s);
unref_pvt(pvt);
Modified: trunk/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Fri Sep 26 09:41:38 2014
@@ -3812,7 +3812,7 @@
if (prune) {
ast_mutex_destroy(&s->lock);
ast_mutex_destroy(&s->cx_queue_lock);
- free(s);
+ ast_free(s);
}
}
ast_mutex_unlock(&e->lock);
@@ -3822,7 +3822,7 @@
ast_mutex_destroy(&e->lock);
ast_mutex_destroy(&e->rqnt_queue_lock);
ast_mutex_destroy(&e->cmd_queue_lock);
- free(e);
+ ast_free(e);
}
}
if (prune) {
@@ -3914,7 +3914,7 @@
}
ast_mutex_unlock(&g->msgs_lock);
ast_mutex_destroy(&g->msgs_lock);
- free(g);
+ ast_free(g);
} else {
ast_mutex_unlock(&g->msgs_lock);
gprev = g;
Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=423978&r1=423977&r2=423978
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Fri Sep 26 09:41:38 2014
@@ -8540,16 +8540,16 @@
}
/* Delete all speeddials for this device */
while ((sd = AST_LIST_REMOVE_HEAD(&d->speeddials, list))) {
- free(sd->container);
- free(sd);
+ ast_free(sd->container);
+ ast_free(sd);
}
/* Delete all serviceurls for this device */
while ((surl = AST_LIST_REMOVE_HEAD(&d->serviceurls, list))) {
- free(surl);
+ ast_free(surl);
}
[... 1243 lines stripped ...]
More information about the svn-commits
mailing list