mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05: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:
parent
5e8f1f9c85
commit
899b26b3bc
@ -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';
|
||||
char* result = NULL;
|
||||
if (plain_str) {
|
||||
result = strndup(plain_str, len);
|
||||
gpgme_free(plain_str);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user