diff options
author | Jonathan Rose <jrose@digium.com> | 2012-05-10 18:35:14 +0000 |
---|---|---|
committer | Jonathan Rose <jrose@digium.com> | 2012-05-10 18:35:14 +0000 |
commit | 8227f70cd70f497cb03c1f9aab63950bcd979d8b (patch) | |
tree | 4f4587c0997f7a2d7ad8c6ecc89c3ad2971d5027 /main | |
parent | 3430da58e9f168e608e46133225e0fc81589f6ef (diff) |
Coverity Report: Fix issues for error type CHECKED_RETURN for core
(issue ASTERISK-19658)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1905/
........
Merged revisions 366094 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 366106 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/acl.c | 6 | ||||
-rw-r--r-- | main/asterisk.c | 9 | ||||
-rw-r--r-- | main/features.c | 4 | ||||
-rw-r--r-- | main/pbx.c | 4 | ||||
-rw-r--r-- | main/xmldoc.c | 6 |
5 files changed, 22 insertions, 7 deletions
diff --git a/main/acl.c b/main/acl.c index 7616236bc..590202653 100644 --- a/main/acl.c +++ b/main/acl.c @@ -533,7 +533,11 @@ int ast_apply_ha(const struct ast_ha *ha, const struct ast_sockaddr *addr) if (ast_sockaddr_is_ipv6(addr)) { if (ast_sockaddr_is_ipv4_mapped(addr)) { /* IPv4 ACLs apply to IPv4-mapped addresses */ - ast_sockaddr_ipv4_mapped(addr, &mapped_addr); + if (!ast_sockaddr_ipv4_mapped(addr, &mapped_addr)) { + ast_log(LOG_ERROR, "%s provided to ast_sockaddr_ipv4_mapped could not be converted. That shouldn't be possible.\n", + ast_sockaddr_stringify(addr)); + continue; + } addr_to_use = &mapped_addr; } else { /* An IPv4 ACL does not apply to an IPv6 address */ diff --git a/main/asterisk.c b/main/asterisk.c index d7fda9588..972c2fbb1 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1468,7 +1468,11 @@ static int ast_makesocket(void) ast_log(LOG_WARNING, "Unable to register network verboser?\n"); } - ast_pthread_create_background(<hread, NULL, listener, NULL); + if (ast_pthread_create_background(<hread, NULL, listener, NULL)) { + ast_log(LOG_WARNING, "Unable to create listener thread.\n"); + close(ast_socket); + return -1; + } if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) { struct passwd *pw; @@ -3345,9 +3349,8 @@ static void *canary_thread(void *unused) sleep(120); for (;;) { - stat(canary_filename, &canary_stat); now = ast_tvnow(); - if (now.tv_sec > canary_stat.st_mtime + 60) { + if (stat(canary_filename, &canary_stat) || now.tv_sec > canary_stat.st_mtime + 60) { ast_log(LOG_WARNING, "The canary is no more. He has ceased to be! " "He's expired and gone to meet his maker! " diff --git a/main/features.c b/main/features.c index c9ea91ac5..4ff629fb4 100644 --- a/main/features.c +++ b/main/features.c @@ -8658,7 +8658,9 @@ int ast_features_init(void) return res; } ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features)); - ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL); + if (ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL)) { + return -1; + } ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL); res = ast_register_application2(parkedcall, parked_call_exec, NULL, NULL, NULL); if (!res) diff --git a/main/pbx.c b/main/pbx.c index e4774f2ef..f04051ceb 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -6709,8 +6709,10 @@ static int show_debug_helper(int fd, const char *context, const char *exten, str dpc->context_existence = 1; - if (!c->pattern_tree) + if (!c->pattern_tree) { + /* Ignore check_return warning from Coverity for ast_exists_extension below */ ast_exists_extension(NULL, c->name, "s", 1, ""); /* do this to force the trie to built, if it is not already */ + } ast_rdlock_context(c); diff --git a/main/xmldoc.c b/main/xmldoc.c index 700813457..f3deb5dc3 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -1715,7 +1715,11 @@ static void xmldoc_parse_parameter(struct ast_xml_node *fixnode, const char *tab ast_xml_free_attr(paramname); printed = 1; } - xmldoc_parse_para(node, internaltabs, "\n", buffer); + if (xmldoc_parse_para(node, internaltabs, "\n", buffer)) { + /* If anything ever goes in below this condition before the continue below, + * we should probably continue immediately. */ + continue; + } continue; } else if ((xmldoc_parse_specialtags(node, internaltabs, "\n", buffer))) { continue; |