mirror of https://github.com/ecmwf/eccodes.git
Memory leak in case of error
This commit is contained in:
parent
8c0b0ec26b
commit
2654faa154
|
@ -269,14 +269,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
|||
}
|
||||
|
||||
code = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size);
|
||||
if (!code) {
|
||||
grib_context_log(a->context, GRIB_LOG_FATAL,
|
||||
"unable to allocate %ld bytes", (long)size);
|
||||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!code) return GRIB_OUT_OF_MEMORY;
|
||||
|
||||
if ((err = grib_unpack_long((grib_accessor*)tableAccessor, code, &size)) != GRIB_SUCCESS)
|
||||
if ((err = grib_unpack_long((grib_accessor*)tableAccessor, code, &size)) != GRIB_SUCCESS) {
|
||||
grib_context_free(a->context, code);
|
||||
return err;
|
||||
}
|
||||
|
||||
table = tableAccessor->table;
|
||||
|
||||
|
|
Loading…
Reference in New Issue