The line
return NT_STATUS_UNSUCCESSFUL;
in svc_install() in service.c returns from the middle of the function when it appears that it ought to clean up first, with talloc_free() and/or whatnot. Please correct me if I'm wrong --- I don't fully understand the code (yet) but this looks enough like a bug that I thought I'd bring it to the author's attention.
[...]
{
struct SERVICE_STATUS s;
do {
msleep(100);
status = svc_QueryServiceStatus(svc_pipe, &svc_handle, &s);
NT_ERR(status, 1, "QueryServiceStatus failed");
} while (s.state == SVCCTL_START_PENDING);
if (s.state != SVCCTL_RUNNING) {
DEBUG(0, ("Service cannot start, status=0x%08X\n", s.state));
return NT_STATUS_UNSUCCESSFUL;
}
}
svc_CloseServiceHandle(svc_pipe, &svc_handle);
svc_CloseServiceHandle(svc_pipe, &scm_handle);
talloc_free(svc_pipe);
return status;
}
This can be closed: the caller always exits soon after NT_STATUS_UNSUCCESSFUL.