mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 15:08:53 +00:00
lock.c: Check *lt before dereferencing it
*lt is NULL if t->tracking == 0 ASTERISK-25948 #close Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
This commit is contained in:
committed by
Richard Mudgett
parent
cc9b72208f
commit
c991e5472e
16
main/lock.c
16
main/lock.c
@@ -286,17 +286,19 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
|
|||||||
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
if (wait_time > reported_wait && (wait_time % 5) == 0) {
|
||||||
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
|
||||||
filename, lineno, func, (int) wait_time, mutex_name);
|
filename, lineno, func, (int) wait_time, mutex_name);
|
||||||
ast_reentrancy_lock(lt);
|
if (lt) {
|
||||||
|
ast_reentrancy_lock(lt);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
__dump_backtrace(<->backtrace[lt->reentrancy], canlog);
|
||||||
#endif
|
#endif
|
||||||
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
|
||||||
lt->file[ROFFSET], lt->lineno[ROFFSET],
|
lt->file[ROFFSET], lt->lineno[ROFFSET],
|
||||||
lt->func[ROFFSET], mutex_name);
|
lt->func[ROFFSET], mutex_name);
|
||||||
#ifdef HAVE_BKTR
|
#ifdef HAVE_BKTR
|
||||||
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
__dump_backtrace(<->backtrace[ROFFSET], canlog);
|
||||||
#endif
|
#endif
|
||||||
ast_reentrancy_unlock(lt);
|
ast_reentrancy_unlock(lt);
|
||||||
|
}
|
||||||
reported_wait = wait_time;
|
reported_wait = wait_time;
|
||||||
}
|
}
|
||||||
usleep(200);
|
usleep(200);
|
||||||
|
Reference in New Issue
Block a user