revert my pass through the tree to remove checks of the result of ast_strdupa

(revisions 8378 through 8381)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-01-21 17:50:04 +00:00
parent fbdc8ce317
commit 9fa6eb5e07
51 changed files with 544 additions and 156 deletions

View File

@@ -3284,23 +3284,28 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
/* Attach only the first format */
stringp = fmt = ast_strdupa(fmt);
strsep(&stringp, "|");
fmt = ast_strdupa(fmt);
if (fmt) {
stringp = fmt;
strsep(&stringp, "|");
if (!ast_strlen_zero(vmu->email)) {
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
char *myserveremail = serveremail;
attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
}
if (!ast_strlen_zero(vmu->email)) {
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
char *myserveremail = serveremail;
attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
}
if (!ast_strlen_zero(vmu->pager)) {
char *myserveremail = serveremail;
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
if (!ast_strlen_zero(vmu->pager)) {
char *myserveremail = serveremail;
if (!ast_strlen_zero(vmu->serveremail))
myserveremail = vmu->serveremail;
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
}
} else {
ast_log(LOG_ERROR, "Out of memory\n");
}
if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5053,6 +5058,11 @@ static int vm_execmain(struct ast_channel *chan, void *data)
);
parse = ast_strdupa(data);
if (!parse) {
ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
AST_STANDARD_APP_ARGS(args, parse);
@@ -5638,6 +5648,11 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
box = ast_strdupa(data);
if (!box) {
ast_log(LOG_ERROR, "Out of memory\n");
LOCAL_USER_REMOVE(u);
return -1;
}
AST_STANDARD_APP_ARGS(args, box);
@@ -5675,6 +5690,10 @@ static int vmauthenticate(struct ast_channel *chan, void *data)
if (s) {
s = ast_strdupa(s);
if (!s) {
ast_log(LOG_ERROR, "Out of memory\n");
return -1;
}
user = strsep(&s, "|");
options = strsep(&s, "|");
if (user) {
@@ -6121,22 +6140,28 @@ static int load_config(void)
if ((z = ast_malloc(sizeof(*z)))) {
char *msg_format, *timezone;
msg_format = ast_strdupa(var->value);
timezone = strsep(&msg_format, "|");
if (msg_format) {
ast_copy_string(z->name, var->name, sizeof(z->name));
ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
z->next = NULL;
if (zones) {
zonesl->next = z;
zonesl = z;
if (msg_format != NULL) {
timezone = strsep(&msg_format, "|");
if (msg_format) {
ast_copy_string(z->name, var->name, sizeof(z->name));
ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
z->next = NULL;
if (zones) {
zonesl->next = z;
zonesl = z;
} else {
zones = z;
zonesl = z;
}
} else {
zones = z;
zonesl = z;
ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
free(z);
}
} else {
ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
free(z);
return -1;
}
} else {
return -1;