okoeroo/drssl — pull request #1 by flupzor (2013-11-27 10:40:06+00:00)
Title: Miscfixes

Most of these memory leaks/FD leaks don't matter much because only one check is done and then the OS cleans up the FDs and memory of the process. But if multiple connections would ever be implemented this would be useful. There are a lot more memory leaks, if I figure out how OpenSSL works i'll do another pull request ;)

* Fix a bunch of memory leaks.
* Fail if /dev/urandom doesn't exist.
* Use the string representation of the port for getaddrinfo.
* Don't free OpenSSL memory which was allocated for internal use.
* Print usage to stderr
* exit(3) in usage

Printing usage to stderr, I believe is convention, but i'm not sure if every projects does this. You can't easily use a pager, to view the usage() output that is printed to stderr which can annoying if the usage() description is too big. Usually either the usage() prints a small summary of the parameters and the rest is described in the man page or usage() prints the entire man page and it is either printed to stderr or stdout. I prefer a small summary with an additional man page.

If you want I can create another pull request without printing usage() to stderr.