mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
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
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user