From 52f0b0913d508fdbc56e5f959ece4f48779657d5 Mon Sep 17 00:00:00 2001 From: Andrea Dalla Costa Date: Sat, 28 Dec 2019 21:05:16 +0100 Subject: [PATCH] ead: fix resource leak in tinysrp Add call to fclose for file pointer fp in function t_openpw. The resource leak could happen during an error handling. Signed-off-by: Andrea Dalla Costa --- package/network/services/ead/src/tinysrp/t_pw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/network/services/ead/src/tinysrp/t_pw.c b/package/network/services/ead/src/tinysrp/t_pw.c index 18e929bb79..5da5e26b78 100644 --- a/package/network/services/ead/src/tinysrp/t_pw.c +++ b/package/network/services/ead/src/tinysrp/t_pw.c @@ -94,8 +94,10 @@ t_openpw(fp) else close_flag = 0; - if((tpw = malloc(sizeof(struct t_pw))) == NULL) + if((tpw = malloc(sizeof(struct t_pw))) == NULL) { + fclose(fp); return NULL; + } tpw->instream = fp; tpw->close_on_exit = close_flag; tpw->state = FILE_ONLY; -- 2.25.1