mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
CHAOS: avoid crash if string create fails
Validate string buffer allocation before using them. ASTERISK-25323 Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0
This commit is contained in:
@@ -781,8 +781,16 @@ static int cdr_handler(struct ast_cdr *cdr)
|
|||||||
struct ast_str *sql1 = ast_str_create(160), *sql2 = ast_str_create(16);
|
struct ast_str *sql1 = ast_str_create(160), *sql2 = ast_str_create(16);
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
|
if (!sql1 || !sql2) {
|
||||||
|
ast_free(sql1);
|
||||||
|
ast_free(sql2);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!tbl) {
|
if (!tbl) {
|
||||||
ast_log(LOG_WARNING, "No such table: %s\n", cdr_table);
|
ast_log(LOG_WARNING, "No such table: %s\n", cdr_table);
|
||||||
|
ast_free(sql1);
|
||||||
|
ast_free(sql2);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user