[Asterisk-code-review] lock.c: Check *lt before dereferencing it (asterisk[11])
Joshua Colp
asteriskteam at digium.com
Thu Apr 21 11:35:51 CDT 2016
Joshua Colp has uploaded a new change for review.
https://gerrit.asterisk.org/2675
Change subject: lock.c: Check *lt before dereferencing it
......................................................................
lock.c: Check *lt before dereferencing it
*lt is NULL if t->tracking == 0
ASTERISK-25948 #close
Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
---
M main/lock.c
1 file changed, 9 insertions(+), 7 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/2675/1
diff --git a/main/lock.c b/main/lock.c
index dd90d7b..03f1cd9 100644
--- a/main/lock.c
+++ b/main/lock.c
@@ -286,17 +286,19 @@
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(<->backtrace[lt->reentrancy], canlog);
+ __dump_backtrace(<->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(<->backtrace[ROFFSET], canlog);
+ __dump_backtrace(<->backtrace[ROFFSET], canlog);
#endif
- ast_reentrancy_unlock(lt);
+ ast_reentrancy_unlock(lt);
+ }
reported_wait = wait_time;
}
usleep(200);
--
To view, visit https://gerrit.asterisk.org/2675
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Diederik de Groot <dkgroot at talon.nl>
More information about the asterisk-code-review
mailing list