Then hopefully that code isn't in the same repository during develoment, but as a separate library. Everything else makes no sense.
The open source code can be useful even if it doesn't run without the library you didn't release.
> or on third-party ones they can't release.
Again, I hope for you, you didn't check in this stuff in your main code repository.
> It must also be checked to make sure it doesn't have any security implications (credentials, information about internal architectures, etc).
If your code has hard coded credentials you should probably start by firing your developers. As for the architecture part, if you need to do security by obscurity you're doing it wrong anyways.
> Finally, releasing it may expose them to patent attacks of which existence they might not even be aware.
Not for canonical, they're based in the UK and there are no software patents in Europe :)
But okay, that might be an issue for some US based companies.
Edit: IANAL, the situation might be a bit different in the UK than in the rest of europe, so I might be wrong: https://en.wikipedia.org/wiki/Software_patents_under_United_...