mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
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>
This commit is contained in:
parent
6fba88de19
commit
52f0b0913d
@ -94,8 +94,10 @@ t_openpw(fp)
|
|||||||
else
|
else
|
||||||
close_flag = 0;
|
close_flag = 0;
|
||||||
|
|
||||||
if((tpw = malloc(sizeof(struct t_pw))) == NULL)
|
if((tpw = malloc(sizeof(struct t_pw))) == NULL) {
|
||||||
|
fclose(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
tpw->instream = fp;
|
tpw->instream = fp;
|
||||||
tpw->close_on_exit = close_flag;
|
tpw->close_on_exit = close_flag;
|
||||||
tpw->state = FILE_ONLY;
|
tpw->state = FILE_ONLY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user