metrics: fix memory leak on allocation failure
If an error occurred when allocating memory for metrics or names,
the function returned without freeing allocated memory. This is now
fixed to avoid the resource leak in the case that either metrics or
names had been successfully allocated memory.
Coverity issue: 362053
Fixes:
c5b7197f662e ("telemetry: move some functions to metrics library")
Cc: stable@dpdk.org
Reported-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>