Permalink
Browse files

Valgrind was complaining about pthread_rwlock_init() accessing

uninitialized memory. I doubt this solves any real problem, although
it does not hurt either.

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6844 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 033d78a commit fb10eaa64037813860561732a3deb15eed536bf2 @alobbs alobbs committed Sep 14, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 cherokee/common-internal.h
@@ -118,7 +118,10 @@
# define CHEROKEE_MUTEX_DESTROY(m) pthread_mutex_destroy(m)
# define CHEROKEE_MUTEX_TRY_LOCK(m) pthread_mutex_trylock(m)
-# define CHEROKEE_RWLOCK_INIT(m,n) pthread_rwlock_init(m,n)
+# define CHEROKEE_RWLOCK_INIT(m,n) do { \
+ memset (m, 0, sizeof(pthread_rwlock_t)); \
+ pthread_rwlock_init(m,n); \
+ } while(0)
# define CHEROKEE_RWLOCK_READER(m) pthread_rwlock_rdlock(m)
# define CHEROKEE_RWLOCK_WRITER(m) pthread_rwlock_wrlock(m)
# define CHEROKEE_RWLOCK_TRYREADER(m) pthread_rwlock_tryrdlock(m)

0 comments on commit fb10eaa

Please sign in to comment.