about summary refs log tree commit diff
path: root/nscd/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/mem.c')
-rw-r--r--nscd/mem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nscd/mem.c b/nscd/mem.c
index 80ea951146..fcea6dbd03 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -566,6 +566,9 @@ mempool_alloc (struct database_dyn *db, size_t len, int data_alloc)
 	    }
 	}
 
+      if (data_alloc)
+	pthread_rwlock_unlock (&db->lock);
+
       if (! db->last_alloc_failed)
 	{
 	  dbg_log (_("no more memory for database '%s'"), dbnames[db - dbs]);
@@ -588,8 +591,5 @@ mempool_alloc (struct database_dyn *db, size_t len, int data_alloc)
 
   pthread_mutex_unlock (&db->memlock);
 
-  if (data_alloc)
-    pthread_rwlock_unlock (&db->lock);
-
   return res;
 }