Potential segmentation fault fixed
If I see it right there could be a segmentation fault if used in echo mode. When you choose echo mode the variable message wouldn't be initialised with a value and in the cleanup function the not allocated memory would be free'ed. This could lead to a segmentation fault in my eyes.