diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-05-30 10:21:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-05-30 10:21:32 +0300 |
commit | ed14564822983b6b7cfa7b3c7d8104b15a019255 (patch) | |
tree | ec5db19f319930830904381de7be93be2e47f565 | |
parent | 5e2333e8119113c729874982eca32941162fe811 (diff) | |
download | gdbm-ed14564822983b6b7cfa7b3c7d8104b15a019255.tar.gz gdbm-ed14564822983b6b7cfa7b3c7d8104b15a019255.tar.bz2 |
Fix memory leak in _gdbm_get_bucket
-rw-r--r-- | src/bucket.c | 2 | ||||
-rw-r--r-- | src/gdbmopen.c | 6 | ||||
-rw-r--r-- | src/proto.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/bucket.c b/src/bucket.c index 7d65e32..c75db42 100644 --- a/src/bucket.c +++ b/src/bucket.c @@ -130,3 +130,3 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index) } - _gdbm_init_cache_entry (dbf, lru); + _gdbm_cache_entry_invalidate (dbf, lru); diff --git a/src/gdbmopen.c b/src/gdbmopen.c index 5d8dc50..9c10d3d 100644 --- a/src/gdbmopen.c +++ b/src/gdbmopen.c @@ -655,3 +655,4 @@ _gdbm_init_cache (GDBM_FILE dbf, size_t size) } - _gdbm_init_cache_entry (dbf, index); + dbf->bucket_cache[index].ca_data.dptr = NULL; + _gdbm_cache_entry_invalidate (dbf, index); } @@ -664,3 +665,3 @@ _gdbm_init_cache (GDBM_FILE dbf, size_t size) void -_gdbm_init_cache_entry (GDBM_FILE dbf, int index) +_gdbm_cache_entry_invalidate (GDBM_FILE dbf, int index) { @@ -670,3 +671,2 @@ _gdbm_init_cache_entry (GDBM_FILE dbf, int index) dbf->bucket_cache[index].ca_data.elem_loc = -1; - dbf->bucket_cache[index].ca_data.dptr = NULL; } diff --git a/src/proto.h b/src/proto.h index c8c9e53..9592f52 100644 --- a/src/proto.h +++ b/src/proto.h @@ -50,3 +50,3 @@ void _gdbm_fatal (GDBM_FILE, const char *); int _gdbm_init_cache (GDBM_FILE, size_t); -void _gdbm_init_cache_entry (GDBM_FILE, int); +void _gdbm_cache_entry_invalidate (GDBM_FILE, int); |