[PATCH uhttpd 3/3] main: free port string after strdup()

Hauke Mehrtens hauke at hauke-m.de
Thu Dec 31 20:17:59 EST 2020


This fixes a memory leak.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/main.c b/main.c
index 73e3d42..bca69cf 100644
--- a/main.c
+++ b/main.c
@@ -298,6 +298,7 @@ int main(int argc, char **argv)
 		case 'p':
 			optarg = strdup(optarg);
 			bound += add_listener_arg(optarg, (ch == 's'));
+			free(optarg);
 			break;
 
 		case 'h':
-- 
2.20.1




More information about the openwrt-devel mailing list