[sr-dev] git:master:181c3cfa: crypto: safety check for memory allocation and free on error cases