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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 21 13:25:50 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 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(&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/2675
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
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