diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-06-06 21:20:11 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-06-06 21:20:11 +0000 |
commit | 9d05ff8ed5f2c898370896ff7a8bb67885596ba1 (patch) | |
tree | 5503cb153c9de46c07e3a0a521cc996926ed375b /main/tdd.c | |
parent | 033a3df22aa68f04327066e0567b76f73c437651 (diff) |
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
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++) |