From 2e8368b3f89a54aedd277ab09446662fbd468da1 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 30 Aug 2019 14:41:01 +0100 Subject: [PATCH] GRIB: Fix memory leak --- ...grib_accessor_class_data_g1second_order_row_by_row_packing.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.c b/src/grib_accessor_class_data_g1second_order_row_by_row_packing.c index 14af69442..54d6dd634 100644 --- a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.c +++ b/src/grib_accessor_class_data_g1second_order_row_by_row_packing.c @@ -325,6 +325,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t *len) } numbersPerRow=(long*)grib_context_malloc_clear(a->context,sizeof(long)*numberOfRows); + if(!numbersPerRow) return GRIB_OUT_OF_MEMORY; if (bitmapPresent) { long *bitmap,*pbitmap; size_t numberOfPoints=Ni*Nj; @@ -417,6 +418,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t *len) grib_context_free(a->context,X); grib_context_free(a->context,groupWidths); if (plSize) grib_context_free(a->context,pl); + if (numbersPerRow) grib_context_free(a->context,numbersPerRow); return ret; }