diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-11-25 21:29:30 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-11-25 21:29:30 +0000 |
commit | e8667ddc01786cfe79861a0031d6244212fd7a65 (patch) | |
tree | 4fdb82b812bf2e98829db72a095f90efb7e60ab1 | |
parent | 30294ea4495e48e0103fee4d855737a281cc49fa (diff) | |
download | glibc-e8667ddc01786cfe79861a0031d6244212fd7a65.zip glibc-e8667ddc01786cfe79861a0031d6244212fd7a65.tar.gz glibc-e8667ddc01786cfe79861a0031d6244212fd7a65.tar.bz2 |
Clear array before use.
* nscd/hstcache.c (cache_addhst): Likewise.
* nscd/grpcache.c (cache_addgr): Likewise.
* nscd/servicescache.c (cache_addserv): Likewise.
* nscd/pwdcache.c (cache_addpw): Likewise.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | nscd/grpcache.c | 2 | ||||
-rw-r--r-- | nscd/hstcache.c | 2 | ||||
-rw-r--r-- | nscd/initgrcache.c | 4 | ||||
-rw-r--r-- | nscd/pwdcache.c | 2 | ||||
-rw-r--r-- | nscd/servicescache.c | 2 |
6 files changed, 17 insertions, 2 deletions
@@ -4,10 +4,15 @@ * nscd/mem.c (MAX_STACK_USE): Remove definition here. (gc): Initialize stack_used based on allocation in prune_cache. * nscd/cache.c (prune_cache): Use heap for mark array if necessary. - Clear array bfore use. + Clear array before use. * nscd/aicache.c (addhstaiX): Update statistics counter in case memory allocate failed. + * nscd/hstcache.c (cache_addhst): Likewise. + * nscd/grpcache.c (cache_addgr): Likewise. + * nscd/servicescache.c (cache_addserv): Likewise. + * nscd/pwdcache.c (cache_addpw): Likewise. + * nscd/initgrcache.c (addinitgroupsX): Likewise. 2007-11-23 Ulrich Drepper <drepper@redhat.com> diff --git a/nscd/grpcache.c b/nscd/grpcache.c index 9cb6105..002f04f 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -285,6 +285,8 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, dataset = memcpy (newp, dataset, total + n); alloca_used = false; } + else + ++db->head->addfailed; /* Mark the old record as obsolete. */ dh->usable = false; diff --git a/nscd/hstcache.c b/nscd/hstcache.c index c93691d..cc04158 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -325,6 +325,8 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, dataset = memcpy (newp, dataset, total + req->key_len); alloca_used = false; } + else + ++db->head->addfailed; } /* Mark the old record as obsolete. */ diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index bb4ac37..157cd78 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -110,7 +110,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, bool all_tryagain = true; bool any_success = false; - /* This is temporary memory, we need not (ad must not) call + /* This is temporary memory, we need not (and must not) call mempool_alloc. */ // XXX This really should use alloca. need to change the backends. gid_t *groups = (gid_t *) malloc (size * sizeof (gid_t)); @@ -338,6 +338,8 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, dataset = memcpy (newp, dataset, total + req->key_len); alloca_used = false; } + else + ++db->head->addfailed; /* Mark the old record as obsolete. */ dh->usable = false; diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index 51ea113..bc1b6ba 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -280,6 +280,8 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, dataset = memcpy (newp, dataset, total + n); alloca_used = false; } + else + ++db->head->addfailed; /* Mark the old record as obsolete. */ dh->usable = false; diff --git a/nscd/servicescache.c b/nscd/servicescache.c index d6bf51d..e122cb3 100644 --- a/nscd/servicescache.c +++ b/nscd/servicescache.c @@ -272,6 +272,8 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, dataset = memcpy (newp, dataset, total + req->key_len); alloca_used = false; } + else + ++db->head->addfailed; /* Mark the old record as obsolete. */ dh->usable = false; |