diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 21:20:11 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-06 21:20:11 +0000 |
commit | eb5d461ed4688cafadc76bebf329a2fae454dc12 (patch) | |
tree | 5503cb153c9de46c07e3a0a521cc996926ed375b /main/tdd.c | |
parent | 125558c76fd4870a9133e4974cce6410c89a3593 (diff) |
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/tdd.c')
-rw-r--r-- | main/tdd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/main/tdd.c b/main/tdd.c index 7189f490e..a3ef39282 100644 --- a/main/tdd.c +++ b/main/tdd.c @@ -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++) |