From c537cc377152c553ecba1302ccc8c155e3e6640d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 13 Mar 2021 14:11:43 +0000 Subject: [PATCH] Return correct error code --- src/grib_accessor_class_element.c | 1 - src/grib_accessor_class_long.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/grib_accessor_class_element.c b/src/grib_accessor_class_element.c index 04c9f5ce1..f68f0aab5 100644 --- a/src/grib_accessor_class_element.c +++ b/src/grib_accessor_class_element.c @@ -205,7 +205,6 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) if ((ret = grib_get_long_array_internal(grib_handle_of_accessor(a), self->array, ar, &size)) != GRIB_SUCCESS) return ret; - ar[self->element] = *val; if ((ret = grib_set_long_array_internal(grib_handle_of_accessor(a), self->array, ar, size)) != GRIB_SUCCESS) diff --git a/src/grib_accessor_class_long.c b/src/grib_accessor_class_long.c index 85bac5ebc..6350ef106 100644 --- a/src/grib_accessor_class_long.c +++ b/src/grib_accessor_class_long.c @@ -233,7 +233,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) values = (long*)grib_context_malloc(a->context, rlen * sizeof(long)); if (!values) - return GRIB_INTERNAL_ERROR; + return GRIB_OUT_OF_MEMORY; ret = grib_unpack_long(a, values, &rlen); if (ret != GRIB_SUCCESS) {