dotcloud/docker — pull request #1947 by vieux (2013-09-20 17:24:46+00:00)
Title: Add cleanup when container.Start fails

git diff is really messy, here is a quick explanation:

I took some of the cleanup code from monitor to make a container.cleanup method
In container.Start, if there is an error, I call container.cleanup() before returning the error.

With this fix, when you use -p and the starts fails, the ports are released. See #1928