If the attempt of generating output for the previous metric doesn’t completely
consume the stack, the next metric will start with a non-empty stack, which breaks
the metrics output.
/* Export the HELP/TYPE header for the current metric */
str_truncate(req->labels, req->labels_pos);
req->has_submetric = FALSE;
+ if (array_is_created(&req->sub_metric_stack))
+ array_clear(&req->sub_metric_stack);
openmetrics_export_metric_header(req, out);
req->state = OPENMETRICS_REQUEST_STATE_SUB_METRICS;
break;