diff --git a/src/grib_accessor_class_long_vector.c b/src/grib_accessor_class_long_vector.c index 74bbb1a9e..3f995dc11 100644 --- a/src/grib_accessor_class_long_vector.c +++ b/src/grib_accessor_class_long_vector.c @@ -185,12 +185,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) /*TODO implement the dirty mechanism to avoid to unpack every time */ err = grib_get_size(grib_handle_of_accessor(a), self->vector, &size); - DebugAssert(!err); + if (err) return err; DebugAssert(size > 0); vector = (long*)grib_context_malloc(a->context, sizeof(long) * size); err = grib_unpack_long(va, vector, &size); - DebugAssert(!err); grib_context_free(a->context, vector); + if (err) return err; *val = v->v[self->index];