Merged revisions 46067 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46067 | russell | 2006-10-23 21:27:42 -0400 (Mon, 23 Oct 2006) | 7 lines

In muted.c, check the return value of strdup.  In ael_main.c, check the return
value of calloc.  (issue #8157)

In passing fix a few minor bugs in ael_main.c.  The last argument to strncpy()
was a hard-coded 100, where it should have been 99.  I changed this to use
sizeof() - 1.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-10-24 01:28:45 +00:00
parent 18b7e4b699
commit 283b1bdeb3
2 changed files with 23 additions and 9 deletions

View File

@@ -85,8 +85,15 @@ static void add_channel(char *tech, char *location)
chan = malloc(sizeof(struct channel));
if (chan) {
memset(chan, 0, sizeof(struct channel));
chan->tech = strdup(tech);
chan->location = strdup(location);
if (!(chan->tech = strdup(tech))) {
free(chan);
return;
}
if (!(chan->location = strdup(location))) {
free(chan->tech);
free(chan);
return;
}
chan->next = channels;
channels = chan;
}
@@ -550,7 +557,10 @@ static void append_sub(struct channel *chan, char *name)
sub = malloc(sizeof(struct subchannel));
if (sub) {
memset(sub, 0, sizeof(struct subchannel));
sub->name = strdup(name);
if (!(sub->name = strdup(name))) {
free(sub);
return;
}
sub->next = chan->subs;
chan->subs = sub;
}