diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-04-30 12:11:31 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-04-30 12:11:31 +0000 |
commit | ef73dbc1301bc42c132d15ae6ca866233c0beeb4 (patch) | |
tree | 7386ab88c4f2c43ac417a2ea0b0b19239bdc0b19 /nscd/cache.c | |
parent | 14e44061ad888abbea7239599a9109b41776e41c (diff) |
Diffstat (limited to 'nscd/cache.c')
-rw-r--r-- | nscd/cache.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nscd/cache.c b/nscd/cache.c index 12c4f01e40..7e9b0dc2df 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -155,11 +155,16 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, unsigned long int hash = __nis_hash (key, len) % table->head->module; struct hashentry *newp; - newp = mempool_alloc (table, sizeof (struct hashentry)); + newp = mempool_alloc (table, sizeof (struct hashentry), IDX_record_data); /* If we cannot allocate memory, just do not do anything. */ if (newp == NULL) { ++table->head->addfailed; + + /* Mark the in-flight memory as unused. */ + for (enum in_flight idx = 0; idx < IDX_record_data; ++idx) + mem_in_flight.block[idx].dbidx = -1; + return -1; } @@ -215,6 +220,10 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, else next_wakeup = table->wakeup_time; + /* Mark the in-flight memory as unused. */ + for (enum in_flight idx = 0; idx < IDX_last; ++idx) + mem_in_flight.block[idx].dbidx = -1; + return 0; } |