]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
make sure malloc was successful before doing memset (bug #2704)
authorRussell Bryant <russell@russellbryant.com>
Sun, 24 Oct 2004 21:09:40 +0000 (21:09 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sun, 24 Oct 2004 21:09:40 +0000 (21:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4087 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_modem.c

index c2f3bf0f9e1d7d8b6ead1c6540c29fb0a90a0725..d53d3958a5e7dc655ea45b1e34f8e5fcffe12cd4 100755 (executable)
@@ -707,8 +707,8 @@ static struct ast_modem_pvt *mkif(char *iface)
 #endif
        
        tmp = malloc(sizeof(struct ast_modem_pvt));
-       memset(tmp, 0, sizeof(struct ast_modem_pvt));
        if (tmp) {
+               memset(tmp, 0, sizeof(struct ast_modem_pvt));
                tmp->fd = open(iface, O_RDWR | O_NONBLOCK);
                if (tmp->fd < 0) {
                        ast_log(LOG_WARNING, "Unable to open '%s'\n", iface);