In OX implementation gpgme's buffer remains untouched, thus not leading to the crash. But code can be shorter and more concise.