DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak
@ 2020-10-13 15:56 Ciara Power
  2020-10-15 17:02 ` Kevin Laatz
  0 siblings, 1 reply; 3+ messages in thread
From: Ciara Power @ 2020-10-13 15:56 UTC (permalink / raw)
  To: dev; +Cc: Ciara Power, Kevin Laatz

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.

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

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test/test_telemetry_data.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
index 7a31e68a78..f3807a7255 100644
--- a/app/test/test_telemetry_data.c
+++ b/app/test/test_telemetry_data.c
@@ -327,6 +327,7 @@ connect_to_socket(void)
 	if (bytes < 0) {
 		printf("%s: Error with socket read - %s\n", __func__,
 				strerror(errno));
+		close(sock);
 		return -1;
 	}
 	buf[bytes] = '\0';
-- 
2.22.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak
  2020-10-13 15:56 [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak Ciara Power
@ 2020-10-15 17:02 ` Kevin Laatz
  2020-10-19 14:59   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Laatz @ 2020-10-15 17:02 UTC (permalink / raw)
  To: Ciara Power, dev

On 13/10/2020 16:56, Ciara Power wrote:
> 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.
>
> Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")
> Coverity issue: 363043
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>   app/test/test_telemetry_data.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
> index 7a31e68a78..f3807a7255 100644
> --- a/app/test/test_telemetry_data.c
> +++ b/app/test/test_telemetry_data.c
> @@ -327,6 +327,7 @@ connect_to_socket(void)
>   	if (bytes < 0) {
>   		printf("%s: Error with socket read - %s\n", __func__,
>   				strerror(errno));
> +		close(sock);
>   		return -1;
>   	}
>   	buf[bytes] = '\0';


Acked-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak
  2020-10-15 17:02 ` Kevin Laatz
@ 2020-10-19 14:59   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-10-19 14:59 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Kevin Laatz

15/10/2020 19:02, Kevin Laatz:
> On 13/10/2020 16:56, Ciara Power wrote:
> > 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.
> >
> > Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")
> > Coverity issue: 363043
> >
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> 
> Acked-by: Kevin Laatz <kevin.laatz@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-19 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 15:56 [dpdk-dev] [PATCH] test/telemetry: fix socket resource leak Ciara Power
2020-10-15 17:02 ` Kevin Laatz
2020-10-19 14:59   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).