1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Cleanup p_ox_gpg_decrypt

In OX implementation gpgme's buffer remains untouched, thus not leading to the crash.

But code can be shorter and more concise.
This commit is contained in:
John Hernandez 2023-04-13 15:26:19 +02:00
parent 5e8f1f9c85
commit 899b26b3bc

View File

@ -419,10 +419,12 @@ p_ox_gpg_decrypt(char* base64)
size_t len;
char* plain_str = gpgme_data_release_and_get_mem(plain, &len);
char* result = malloc(len + 1);
memcpy(result, plain_str, len);
result[len] = '\0';
gpgme_free(plain_str);
char* result = NULL;
if (plain_str) {
result = strndup(plain_str, len);
gpgme_free(plain_str);
}
return result;
}