diff mbox series

[OpenWrt-Devel,firewall3,2/2] utils: Free args in __fw3_command_pipe()

Message ID 20181219112312.8707-2-hauke@hauke-m.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [OpenWrt-Devel,firewall3,1/2] options.c, redirects.c: Fix possible buffer overflows | expand

Commit Message

Hauke Mehrtens Dec. 19, 2018, 11:23 a.m. UTC
args was not freed after leaving this function.

Fixes Coverity issue 1412470 Resource leak

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 utils.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jo-Philipp Wich Dec. 19, 2018, 12:52 p.m. UTC | #1
Hi,

> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Acked-by: Jo-Philipp Wich <jo@mein.io>


~ Jo
diff mbox series

Patch

diff --git a/utils.c b/utils.c
index 4f892a7..684b2c3 100644
--- a/utils.c
+++ b/utils.c
@@ -252,6 +252,7 @@  __fw3_command_pipe(bool silent, const char *command, ...)
 	switch ((pid = fork()))
 	{
 	case -1:
+		free(args);
 		return false;
 
 	case 0:
@@ -275,6 +276,7 @@  __fw3_command_pipe(bool silent, const char *command, ...)
 	}
 
 	pipe_fd = fdopen(pfds[1], "w");
+	free(args);
 	return true;
 }