aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/ead/src/tinysrp
diff options
context:
space:
mode:
authorAndrea Dalla Costa <andrea@dallacosta.me>2019-12-28 21:05:16 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2020-01-05 19:36:46 +0100
commit52f0b0913d508fdbc56e5f959ece4f48779657d5 (patch)
tree9a2db97b8ec60b7a381663292f2faa41d34bc1ff /package/network/services/ead/src/tinysrp
parent6fba88de1913301f11163aa05298e4fb488b3640 (diff)
downloadupstream-52f0b0913d508fdbc56e5f959ece4f48779657d5.tar.gz
upstream-52f0b0913d508fdbc56e5f959ece4f48779657d5.tar.bz2
upstream-52f0b0913d508fdbc56e5f959ece4f48779657d5.zip
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 <andrea@dallacosta.me>
Diffstat (limited to 'package/network/services/ead/src/tinysrp')
-rw-r--r--package/network/services/ead/src/tinysrp/t_pw.c4
1 files changed, 3 insertions, 1 deletions
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;