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/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@366094 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2012-05-10 16:47:17 +00:00
parent 965dd3a7d8
commit ae528efea3
15 changed files with 94 additions and 27 deletions

View File

@@ -187,6 +187,7 @@ static enum ast_device_state custom_devstate_callback(const char *data)
{
char buf[256] = "";
/* Ignore check_return warning from Coverity fow ast_db_get below */
ast_db_get(astdb_family, data, buf, sizeof(buf));
return ast_devstate_val(buf);

View File

@@ -486,9 +486,11 @@ static int unload_module(void)
ast_custom_function_unregister(&trylock_function);
ast_custom_function_unregister(&unlock_function);
pthread_cancel(broker_tid);
pthread_kill(broker_tid, SIGURG);
pthread_join(broker_tid, NULL);
if (broker_tid != AST_PTHREADT_NULL) {
pthread_cancel(broker_tid);
pthread_kill(broker_tid, SIGURG);
pthread_join(broker_tid, NULL);
}
AST_LIST_UNLOCK(&locklist);
@@ -500,7 +502,14 @@ static int load_module(void)
int res = ast_custom_function_register(&lock_function);
res |= ast_custom_function_register(&trylock_function);
res |= ast_custom_function_register(&unlock_function);
ast_pthread_create_background(&broker_tid, NULL, lock_broker, NULL);
if (ast_pthread_create_background(&broker_tid, NULL, lock_broker, NULL)) {
ast_log(LOG_ERROR, "Failed to start lock broker thread. Unloading func_lock module.\n");
broker_tid = AST_PTHREADT_NULL;
unload_module();
return AST_MODULE_LOAD_DECLINE;
}
return res;
}