ppp
ppp copied to clipboard
plugins/winbind: minor file handling leak
You use fdopen() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L320 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L322, but later you use close() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442. I think you should use fclose() otherwise you will probably leak few hundred bytes.
Also if the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 fails you should still try to call the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442.
ppp-2.5.0
You use
fdopen()at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L320 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L322, but later you useclose()at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442. I think you should usefclose()otherwise you will probably leak few hundred bytes.
Good point. I agree.
Also if the
close()(orfclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 fails you should still try to call theclose()(orfclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442.
Isn't that why there is the close() at line 436? (which should also be fclose())?
@yarda: Have you seen the @paulusmack comment?
I changed 3 instances of close() to fclose().