Make sure malloc worked before accessing the mem in tdd.c
authorJames Golovich <james@gnuinter.net>
Sat, 23 Oct 2004 06:28:19 +0000 (06:28 +0000)
committerJames Golovich <james@gnuinter.net>
Sat, 23 Oct 2004 06:28:19 +0000 (06:28 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4055 65c4cc65-6c06-0410-ace0-fbb531ad65f3

tdd.c

diff --git a/tdd.c b/tdd.c
index 6ff6c0f..e2a6cc8 100755 (executable)
--- a/tdd.c
+++ b/tdd.c
@@ -77,8 +77,8 @@ struct tdd_state *tdd_new(void)
 {
        struct tdd_state *tdd;
        tdd = malloc(sizeof(struct tdd_state));
-       memset(tdd, 0, sizeof(struct tdd_state));
        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 */