Found by coverity scan. If the process runs out of memory while writing the closing nul bytes to a write command buffer, the _cmessage extension could leak memory.
Since the process would have to have run out of memory to ever hit this bug it seems unlikely to be hit by properly functioning applications.