summaryrefslogtreecommitdiff
path: root/main/lock.c
diff options
context:
space:
mode:
authorDiederik de Groot <dkgroot@talon.nl>2016-04-21 15:26:47 +0200
committerRichard Mudgett <rmudgett@digium.com>2016-04-21 11:07:18 -0500
commitc991e5472ef23db6b02abb2f54f53235f9b5ecbe (patch)
treeb13cf619de9a1370c8063b6e23967b9e724d9b39 /main/lock.c
parentcc9b72208f72f21022ff4f08384ef3316b5aa807 (diff)
lock.c: Check *lt before dereferencing it
*lt is NULL if t->tracking == 0 ASTERISK-25948 #close Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
Diffstat (limited to 'main/lock.c')
-rw-r--r--main/lock.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/main/lock.c b/main/lock.c
index 13b8fb388..2b2a80984 100644
--- a/main/lock.c
+++ b/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) {
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
filename, lineno, func, (int) wait_time, mutex_name);
- ast_reentrancy_lock(lt);
+ if (lt) {
+ ast_reentrancy_lock(lt);
#ifdef HAVE_BKTR
- __dump_backtrace(&lt->backtrace[lt->reentrancy], canlog);
+ __dump_backtrace(&lt->backtrace[lt->reentrancy], canlog);
#endif
- __ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
- lt->file[ROFFSET], lt->lineno[ROFFSET],
- lt->func[ROFFSET], mutex_name);
+ __ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
+ lt->file[ROFFSET], lt->lineno[ROFFSET],
+ lt->func[ROFFSET], mutex_name);
#ifdef HAVE_BKTR
- __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
+ __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
#endif
- ast_reentrancy_unlock(lt);
+ ast_reentrancy_unlock(lt);
+ }
reported_wait = wait_time;
}
usleep(200);