Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2007-06-06 21:20:11 +00:00
parent 033a3df22a
commit 9d05ff8ed5
94 changed files with 2530 additions and 2701 deletions

View File

@@ -101,9 +101,8 @@ void tdd_init(void)
struct tdd_state *tdd_new(void)
{
struct tdd_state *tdd;
tdd = malloc(sizeof(struct tdd_state));
tdd = calloc(1, sizeof(*tdd));
if (tdd) {
memset(tdd, 0, sizeof(struct tdd_state));
tdd->fskd.spb = 176; /* 45.5 baud */
tdd->fskd.hdlc = 0; /* Async */
tdd->fskd.nbit = 5; /* 5 bits */
@@ -143,13 +142,12 @@ int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int len)
int b = 'X';
int res;
int c,x;
short *buf = malloc(2 * len + tdd->oldlen);
short *buf = calloc(1, 2 * len + tdd->oldlen);
short *obuf = buf;
if (!buf) {
ast_log(LOG_WARNING, "Out of memory\n");
return -1;
}
memset(buf, 0, 2 * len + tdd->oldlen);
memcpy(buf, tdd->oldstuff, tdd->oldlen);
mylen += tdd->oldlen/2;
for (x = 0; x < len; x++)