Hello, While importing stunnel 5.82 we found a leak in create_pid() in src/ui_unix.c. If write() to the pid file comes up short, the function returns 1 without releasing the buffer allocated by str_printf(): ----- pid=str_printf("%lu\n", (unsigned long)getpid()); if(write(pf, pid, strlen(pid))<(int)strlen(pid)) { s_log(LOG_ERR, "Cannot write pid file %s", global_options.pidfile); ioerror("write"); (void)close(pf); return 1; /* pid is not released */ } str_free(pid); /* released on the success path */ (void)close(pf); ----- 5.82 added (void)close(pf) to this error path, which fixed the descriptor leak. The matching str_free(pid) is still missing, so the error path and the success path release different things. The impact is minor: this path is only reached at startup when the pid file cannot be written, and stunnel exits right after. Still, the fix is one line and makes both paths release the same resources. Patch against 5.82: ----- --- a/src/ui_unix.c +++ b/src/ui_unix.c @@ -284,6 +284,7 @@ NOEXPORT int create_pid(void) { if(write(pf, pid, strlen(pid))<(int)strlen(pid)) { s_log(LOG_ERR, "Cannot write pid file %s", global_options.pidfile); ioerror("write"); + str_free(pid); (void)close(pf); return 1; } ----- Could you consider this for the next release? If you would prefer the patch in a different form, I am happy to resend it. Best, Simranjeet Get Outlook for Mac<https://aka.ms/GetOutlookForMac>