Hi Sergey,

> Since this is not a real memory leak (the allocations made in the
> init_process method of the ngx_event_core_module module are used up
> to this function and already freed on exit automatically, as this
> function never returns), I don't think there is something to fix.

Agreed, this is not a "real" leak.

But fixing those "false" leaks allows you to run test with sanitizers
on the CI, which can protect you and/or external contributors from
introducing new bugs.

> (Further, the patch misses cycle->files for NGX_USE_FD_EVENT event
> methods.

Good catch, thanks!

> Also, it's probably better to free the memory in the
> exit_process method to obey the ownership (this would also fix
> missing ngx_free() calls on win32), but this would require moving
> code that uses these connections afterwards to catch socket leaks.)

Freeing memory in exit_process could result in use-after-free, since
cleanups for the cycle->pool might still access those connections.

Best regards,
Piotr Sikora
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to