Closed frobones closed 2 years ago
Using valgrind (https://valgrind.org/) I tracked down the issue of a double free to the following line in webserver.c: https://github.com/pupnp/pupnp/blob/master/upnp/src/genlib/net/http/webserver.c#L554
webserver.c
It appears that fp is closed and then is closed again at the exit_function label.
fp
exit_function
Here is the commit that introduced the double close: https://github.com/pupnp/pupnp/commit/0b1a6c59be3babc3ecaf81debdfc159759872215#diff-0b6cfade43473f4ba934e72d8cf4618e511b14e5aefdc60b5ca7a2a6ee18425f
Setting fp to NULL after it is closed indicates that fp is no longer needed in this scope and prevents the second fclose from happening.
NULL
fclose
Hi Stephen,
Good job, just merged your patch.
Please, do not use master, we will continue development from 1.14.x. I know, this is my fault, I must change the branch asap.
Regards, Marcelo.
Using valgrind (https://valgrind.org/) I tracked down the issue of a double free to the following line in
webserver.c
: https://github.com/pupnp/pupnp/blob/master/upnp/src/genlib/net/http/webserver.c#L554It appears that
fp
is closed and then is closed again at theexit_function
label.Here is the commit that introduced the double close: https://github.com/pupnp/pupnp/commit/0b1a6c59be3babc3ecaf81debdfc159759872215#diff-0b6cfade43473f4ba934e72d8cf4618e511b14e5aefdc60b5ca7a2a6ee18425f
Setting
fp
toNULL
after it is closed indicates thatfp
is no longer needed in this scope and prevents the secondfclose
from happening.