From: Andrea Dalla Costa Date: Sat, 28 Dec 2019 20:05:16 +0000 (+0100) Subject: ead: fix resource leak in tinysrp X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=52f0b0913d508fdbc56e5f959ece4f48779657d5;p=openwrt%2Fstaging%2Fnbd.git 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 --- 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;