From: Jaroslav Kysela Date: Thu, 10 Mar 2016 09:09:57 +0000 (+0100) Subject: add CLANG_SANITIZER define X-Git-Tag: v4.2.1~904 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21ce5d322db198cb1cb2e12afb15d750f5a570c8;p=thirdparty%2Ftvheadend.git add CLANG_SANITIZER define --- diff --git a/src/httpc.c b/src/httpc.c index f51ed9520..9882c8359 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -1595,7 +1595,13 @@ http_client_close ( http_client_t *hc ) free(hc->hc_bindaddr); free(hc->hc_rtsp_user); free(hc->hc_rtsp_pass); +#ifdef CLANG_SANITIZER + pthread_mutex_lock(&http_lock); +#endif free(hc); +#ifdef CLANG_SANITIZER + pthread_mutex_unlock(&http_lock); +#endif } /* diff --git a/src/tvheadend.h b/src/tvheadend.h index 43c5defe9..20ee1f60a 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -115,6 +115,12 @@ lock_assert0(pthread_mutex_t *l, const char *file, int line) #define lock_assert(l) lock_assert0(l, __FILE__, __LINE__) +#if defined(__has_feature) +#if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer) +#define CLANG_SANITIZER 1 +#endif +#endif + /* * */