mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 07:01:09 +00:00
make sure malloc was successful before doing memset (bug #2704)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4087 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -707,8 +707,8 @@ static struct ast_modem_pvt *mkif(char *iface)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = malloc(sizeof(struct ast_modem_pvt));
|
tmp = malloc(sizeof(struct ast_modem_pvt));
|
||||||
memset(tmp, 0, sizeof(struct ast_modem_pvt));
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
|
memset(tmp, 0, sizeof(struct ast_modem_pvt));
|
||||||
tmp->fd = open(iface, O_RDWR | O_NONBLOCK);
|
tmp->fd = open(iface, O_RDWR | O_NONBLOCK);
|
||||||
if (tmp->fd < 0) {
|
if (tmp->fd < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to open '%s'\n", iface);
|
ast_log(LOG_WARNING, "Unable to open '%s'\n", iface);
|
||||||
|
Reference in New Issue
Block a user