[asterisk-commits] lock.c: Check *lt before dereferencing it (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 21 13:01:57 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

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(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/lock.c b/main/lock.c
index 13b8fb3..2b2a809 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(&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);

-- 
To view, visit https://gerrit.asterisk.org/2673
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Diederik de Groot <dkgroot at talon.nl>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list