grib_iterator_delete should not crash if input is NULL
@@ -114,9 +114,9 @@ int grib_iterator_init(grib_iterator* i, grib_handle *h, grib_arguments* args)
}
/* For this one, ALL destroy are called */
-
int grib_iterator_delete(grib_iterator *i)
{
+ if (i) {
grib_iterator_class *c = i->cclass;
while(c)
{
@@ -126,5 +126,8 @@ int grib_iterator_delete(grib_iterator *i)
}
/* This should go in a top class */
grib_context_free(i->h->context,i);
+ } else {
+ return GRIB_INVALID_ARGUMENT;
+ }
return 0;
}
