mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Add missing failure checks to ast_str_set_va() callers.
Change-Id: I0c2cdcd53727bdc6634095c61294807255bd278f
This commit is contained in:
@@ -2819,6 +2819,7 @@ AST_THREADSTORAGE(userevent_buf);
|
|||||||
*/
|
*/
|
||||||
void astman_append(struct mansession *s, const char *fmt, ...)
|
void astman_append(struct mansession *s, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
struct ast_str *buf;
|
struct ast_str *buf;
|
||||||
|
|
||||||
@@ -2827,8 +2828,11 @@ void astman_append(struct mansession *s, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ast_str_set_va(&buf, 0, fmt, ap);
|
res = ast_str_set_va(&buf, 0, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if (res == AST_DYNSTR_BUILD_FAILED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->f != NULL || s->session->f != NULL) {
|
if (s->f != NULL || s->session->f != NULL) {
|
||||||
send_string(s, ast_str_buffer(buf));
|
send_string(s, ast_str_buffer(buf));
|
||||||
@@ -2888,6 +2892,7 @@ void astman_send_error(struct mansession *s, const struct message *m, char *erro
|
|||||||
|
|
||||||
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt, ...)
|
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
struct ast_str *buf;
|
struct ast_str *buf;
|
||||||
char *msg;
|
char *msg;
|
||||||
@@ -2897,8 +2902,11 @@ void astman_send_error_va(struct mansession *s, const struct message *m, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ast_str_set_va(&buf, 0, fmt, ap);
|
res = ast_str_set_va(&buf, 0, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if (res == AST_DYNSTR_BUILD_FAILED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* astman_append will use the same underlying buffer, so copy the message out
|
/* astman_append will use the same underlying buffer, so copy the message out
|
||||||
* before sending the response */
|
* before sending the response */
|
||||||
|
@@ -2646,14 +2646,18 @@ struct ast_xml_xpath_results *__attribute__((format(printf, 1, 2))) ast_xmldoc_q
|
|||||||
struct documentation_tree *doctree;
|
struct documentation_tree *doctree;
|
||||||
RAII_VAR(struct ast_str *, xpath_str, ast_str_create(128), ast_free);
|
RAII_VAR(struct ast_str *, xpath_str, ast_str_create(128), ast_free);
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
int res;
|
||||||
|
|
||||||
if (!xpath_str) {
|
if (!xpath_str) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ast_str_set_va(&xpath_str, 0, fmt, ap);
|
res = ast_str_set_va(&xpath_str, 0, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if (res == AST_DYNSTR_BUILD_FAILED) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
AST_RWLIST_RDLOCK(&xmldoc_tree);
|
AST_RWLIST_RDLOCK(&xmldoc_tree);
|
||||||
AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
|
AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
|
||||||
|
Reference in New Issue
Block a user