Memory leaks

This commit is contained in:
Shahram Najm 2020-04-08 23:02:52 +01:00
parent 7b8a892508
commit 9b163f5308
2 changed files with 5 additions and 0 deletions

View File

@ -384,6 +384,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
}
if (str == 0 || strlen(str) == 0) {
grib_context_free(c, str);
*len = 0;
*val = 0;
return ret;

View File

@ -261,6 +261,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
dictionary = grib_trie_new(c);
while (fgets(line, sizeof(line) - 1, f)) {
DebugAssert( strlen(line) > 0 );
if (line[0] == '#') continue;
list = string_split(line, "|");
grib_trie_insert(dictionary, list[0], list);
}
@ -276,6 +278,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
}
while (fgets(line, sizeof(line) - 1, f)) {
DebugAssert( strlen(line) > 0 );
if (line[0] == '#') continue;
list = string_split(line, "|");
grib_trie_insert(dictionary, list[0], list);
}