mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Free hashmap to eliminate memory leaks
This commit is contained in:
parent
d5cb4b9e3e
commit
a248e0dfbe
@ -196,10 +196,13 @@ void
|
||||
free_NC_dimarrayV(NC_dimarray *ncap)
|
||||
{
|
||||
assert(ncap != NULL);
|
||||
|
||||
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
NC_hashmapDelete(ncap->hashmap);
|
||||
ncap->hashmap = NULL;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
free_NC_dimarrayV0(ncap);
|
||||
|
@ -210,6 +210,8 @@ long NC_hashmapCount(NC_hashmap* hash)
|
||||
|
||||
void NC_hashmapDelete(NC_hashmap* hash)
|
||||
{
|
||||
free(hash->table);
|
||||
free(hash);
|
||||
if (hash) {
|
||||
free(hash->table);
|
||||
free(hash);
|
||||
}
|
||||
}
|
||||
|
@ -205,6 +205,9 @@ free_NC_vararrayV(NC_vararray *ncap)
|
||||
if(ncap->nalloc == 0)
|
||||
return;
|
||||
|
||||
NC_hashmapDelete(ncap->hashmap);
|
||||
ncap->hashmap = NULL;
|
||||
|
||||
assert(ncap->value != NULL);
|
||||
|
||||
free_NC_vararrayV0(ncap);
|
||||
@ -333,10 +336,8 @@ NC_hvarid
|
||||
int
|
||||
NC_findvar(const NC_vararray *ncap, const char *uname, NC_var **varpp)
|
||||
{
|
||||
int hash_var_id;
|
||||
NC_var **loc;
|
||||
int hash_var_id;
|
||||
uint32_t shash;
|
||||
int varid;
|
||||
char *name;
|
||||
|
||||
assert(ncap != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user