diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2008-10-15 06:30:11 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2008-10-15 06:30:11 +0000 |
commit | 91d5d9d04a1a0137a6d16089c46f21771b62b3e2 (patch) | |
tree | 5668b30e432c29eac8a4dfbf8eebff02af603c35 /ldap/servers/slapd/rwlock.c | |
parent | f7bc5b0691f58138eeb7783af9743de4410b46c4 (diff) | |
download | ds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.tar.gz ds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.tar.xz ds-91d5d9d04a1a0137a6d16089c46f21771b62b3e2.zip |
Resolves: #466702
Summary: Memory usage research: checking in the experimental code
See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research
Diffstat (limited to 'ldap/servers/slapd/rwlock.c')
-rw-r--r-- | ldap/servers/slapd/rwlock.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ldap/servers/slapd/rwlock.c b/ldap/servers/slapd/rwlock.c index abd55ef1..e210145d 100644 --- a/ldap/servers/slapd/rwlock.c +++ b/ldap/servers/slapd/rwlock.c @@ -193,23 +193,21 @@ rwl_new() { rwl *rp; - if (( rp = (rwl *)malloc( sizeof( rwl ))) == NULL ) { - return NULL; - } + rp = (rwl *)slapi_ch_malloc( sizeof( rwl )); if (( rp->rwl_readers_mutex = PR_NewLock()) == NULL ) { - free( rp ); + slapi_ch_free( (void **)&rp ); return NULL; } if (( rp->rwl_writers_mutex = PR_NewLock()) == NULL ) { PR_DestroyLock( rp->rwl_readers_mutex ); - free( rp ); + slapi_ch_free( (void **)&rp ); return NULL; } if (( rp->rwl_writer_waiting_cv = PR_NewCondVar( rp->rwl_readers_mutex )) == NULL ) { PR_DestroyLock( rp->rwl_readers_mutex ); PR_DestroyLock( rp->rwl_writers_mutex ); - free( rp ); + slapi_ch_free( (void **)&rp ); } rp->rwl_num_readers = rp->rwl_writer_waiting = 0; @@ -254,6 +252,6 @@ rwl_free( rwl **rh ) PR_DestroyCondVar( rp->rwl_writer_waiting_cv ); } memset( rp, '\0', sizeof( rwl )); - free( rp ); + slapi_ch_free( (void **)&rp ); *rh = NULL; } |