DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] examples/ntb: fix resource leaks
@ 2019-08-14  6:07 Xiaoyun Li
  2019-08-14  6:50 ` Ye Xiaolong
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoyun Li @ 2019-08-14  6:07 UTC (permalink / raw)
  To: jingjing.wu, xiaolong.ye; +Cc: dev, Xiaoyun Li, stable

Resource file was not freed or pointed-to in fseek/ftell. This patch
fixed this issue which is found by coverity scan.

Coverity issue: 347277
Fixes: 440af660ff83 ("examples/ntb: fix error handling")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 examples/ntb/ntb_fwd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index f8c970cdb..bf8a73547 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -127,11 +127,13 @@ cmd_sendfile_parsed(void *parsed_result,
 
 	if (fseek(file, 0, SEEK_END) < 0) {
 		printf("Fail to get file size.\n");
+		fclose(file);
 		return;
 	}
 	size = ftell(file);
 	if (fseek(file, 0, SEEK_SET) < 0) {
 		printf("Fail to get file size.\n");
+		fclose(file);
 		return;
 	}
 
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] examples/ntb: fix resource leaks
  2019-08-14  6:07 [dpdk-dev] [PATCH] examples/ntb: fix resource leaks Xiaoyun Li
@ 2019-08-14  6:50 ` Ye Xiaolong
  0 siblings, 0 replies; 2+ messages in thread
From: Ye Xiaolong @ 2019-08-14  6:50 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: jingjing.wu, dev, stable

On 08/14, Xiaoyun Li wrote:
>Resource file was not freed or pointed-to in fseek/ftell. This patch
>fixed this issue which is found by coverity scan.
>
>Coverity issue: 347277
>Fixes: 440af660ff83 ("examples/ntb: fix error handling")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>---
> examples/ntb/ntb_fwd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
>index f8c970cdb..bf8a73547 100644
>--- a/examples/ntb/ntb_fwd.c
>+++ b/examples/ntb/ntb_fwd.c
>@@ -127,11 +127,13 @@ cmd_sendfile_parsed(void *parsed_result,
> 
> 	if (fseek(file, 0, SEEK_END) < 0) {
> 		printf("Fail to get file size.\n");
>+		fclose(file);
> 		return;
> 	}
> 	size = ftell(file);
> 	if (fseek(file, 0, SEEK_SET) < 0) {
> 		printf("Fail to get file size.\n");
>+		fclose(file);
> 		return;
> 	}
> 
>-- 
>2.17.1
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  6:07 [dpdk-dev] [PATCH] examples/ntb: fix resource leaks Xiaoyun Li
2019-08-14  6:50 ` Ye Xiaolong

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox