summaryrefslogtreecommitdiff
path: root/mysys/thr_mutex.c
diff options
context:
space:
mode:
authormonty@mysql.com <>2003-11-21 14:41:57 +0200
committermonty@mysql.com <>2003-11-21 14:41:57 +0200
commitd08945498e44acb968d1aab6d269d9b1874246e6 (patch)
tree1dae851e03d54c7a8de1e73a27a50426cef61563 /mysys/thr_mutex.c
parent19b5da3247c844b52de2706fc3dd19fe0099dc84 (diff)
downloadmariadb-git-d08945498e44acb968d1aab6d269d9b1874246e6.tar.gz
Fixed memory leak with RAID tables
Fixed tests for RAID tables Detect uninitialized mutexes on lock and destroy
Diffstat (limited to 'mysys/thr_mutex.c')
-rw-r--r--mysys/thr_mutex.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 474334efcc0..8ebe5be22e8 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -97,10 +97,12 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
int error;
if (!mp->file)
{
- fprintf(stderr,"safe_mutex: Trying to lock unitialized mutex at %s, line %d", file, line);
+ fprintf(stderr,
+ "safe_mutex: Trying to lock unitialized mutex at %s, line %d\n",
+ file, line);
fflush(stderr);
abort();
- }
+ }
pthread_mutex_lock(&mp->global);
if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
@@ -262,6 +264,14 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
{
int error=0;
+ if (!mp->file)
+ {
+ fprintf(stderr,
+ "safe_mutex: Trying to destroy unitialized mutex at %s, line %d\n",
+ file, line);
+ fflush(stderr);
+ abort();
+ }
if (mp->count != 0)
{
fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n",