diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index be1b2042..35a1c85a 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -503,6 +503,10 @@ class WatchDog { status_ = OEMCrypto_ERROR_INIT_FAILED; LOGE("XXX WATCH DOG ERROR XXX"); SaveFailureInformation(); + // This tells the worker thread to clean up after itself. It is not + // really needed since we are going to abort. However, if somebody + // removes the "abort()" below, then this is needed. + pthread_detach(thread_); // This is controversial. The argument for an abort here is that if we // do not abort, we will suck all the life out of the user's battery. By // saving information to the file system, above, we can still track @@ -514,7 +518,10 @@ class WatchDog { bool should_delete = !gave_up_; OEMCryptoResult status = status_; pthread_mutex_unlock(&mutex_); - if (should_delete) delete this; + if (should_delete) { + pthread_join(thread_, NULL); + delete this; + } return status; }