From 7af73ac84b3f9a1b1101ecc5c5a6d34e44df9f6b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Mar 2010 11:01:50 -0700 Subject: [PATCH] mds: avoid null deref of SimpleLock::_unstable --- src/mds/SimpleLock.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h index 084cd1f33a339..6479b28455abc 100644 --- a/src/mds/SimpleLock.h +++ b/src/mds/SimpleLock.h @@ -181,12 +181,14 @@ private: return _unstable; } void clear_more() { - assert(_unstable->empty()); - delete _unstable; - _unstable = NULL; + if (_unstable) { + assert(_unstable->empty()); + delete _unstable; + _unstable = NULL; + } } void try_clear_more() { - if (_unstable->empty()) { + if (_unstable && _unstable->empty()) { delete _unstable; _unstable = NULL; } -- 2.39.5