mirror of https://github.com/ecmwf/eccodes.git
Memory leak: BUFR
This commit is contained in:
parent
32f7646789
commit
ead17c58e4
|
@ -543,6 +543,7 @@ static int get_descriptors(grib_accessor* a)
|
|||
return ret;
|
||||
|
||||
numberOfDescriptors = grib_bufr_descriptors_array_used_size(self->expanded);
|
||||
if (self->canBeMissing ) grib_context_free(c, self->canBeMissing);
|
||||
self->canBeMissing = (int*)grib_context_malloc_clear(c, numberOfDescriptors * sizeof(int));
|
||||
for (i = 0; i < numberOfDescriptors; i++)
|
||||
self->canBeMissing[i] = grib_bufr_descriptor_can_be_missing(self->expanded->v[i]);
|
||||
|
@ -860,6 +861,7 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu
|
|||
}
|
||||
grib_buffer_set_ulength_bits(c, buff, buff->ulength_bits + 6);
|
||||
grib_encode_unsigned_longb(buff->data, localWidth, pos, 6);
|
||||
grib_context_free(c, values);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -491,8 +491,10 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
|
|||
err = grib_unpack_string(a, value, &size);
|
||||
p = value;
|
||||
r = compute_bufr_key_rank(h, self->keys, a->name);
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size))
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size)) {
|
||||
grib_context_free(c, value);
|
||||
return;
|
||||
}
|
||||
|
||||
while (*p) {
|
||||
if (!isprint(*p))
|
||||
|
|
|
@ -517,8 +517,10 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
|
|||
err = grib_unpack_string(a, value, &size);
|
||||
p = value;
|
||||
r = compute_bufr_key_rank(h, self->keys, a->name);
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size))
|
||||
if (grib_is_missing_string(a, (unsigned char*)value, size)) {
|
||||
grib_context_free(c, value);
|
||||
return;
|
||||
}
|
||||
|
||||
while (*p) {
|
||||
if (!isprint(*p))
|
||||
|
|
|
@ -160,6 +160,7 @@ int main(int argc, char** argv)
|
|||
void* runner(void* ptr)
|
||||
{
|
||||
do_stuff(ptr);
|
||||
free(ptr);
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1296,8 +1296,10 @@ static int compare_all_dump_keys(grib_handle* handle1, grib_handle* handle2, gri
|
|||
prefix = (char*)xa->name;
|
||||
}
|
||||
|
||||
if (blacklisted(prefix))
|
||||
if (blacklisted(prefix)) {
|
||||
if (dofree) grib_context_free(context, prefix);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Compare the key itself */
|
||||
if (compare_values(options, handle1, handle2, prefix, GRIB_TYPE_UNDEFINED)) {
|
||||
|
|
Loading…
Reference in New Issue