test/telemetry: fix socket resource leak
authorCiara Power <ciara.power@intel.com>
Tue, 13 Oct 2020 15:56:48 +0000 (16:56 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 19 Oct 2020 15:01:58 +0000 (17:01 +0200)
commit89ce9f09e28f0a07694ce12f4bf331f8ddc8e539
tree9d673115fb114b3dc3d4d97aff60baaa97c371d9
parent8b4a23f1152f921fb2de35b3474d9a738cf14b54
test/telemetry: fix socket resource leak

If an error occurred when reading from the socket, the function
returned without closing the socket. This is now fixed to avoid the
resource leak of the sock variable going out of scope.

Coverity issue: 363043
Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
app/test/test_telemetry_data.c