mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -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
10
src/pgp/ox.c
10
src/pgp/ox.c
@ -419,10 +419,12 @@ p_ox_gpg_decrypt(char* base64)
|
|||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
char* plain_str = gpgme_data_release_and_get_mem(plain, &len);
|
char* plain_str = gpgme_data_release_and_get_mem(plain, &len);
|
||||||
char* result = malloc(len + 1);
|
char* result = NULL;
|
||||||
memcpy(result, plain_str, len);
|
if (plain_str) {
|
||||||
result[len] = '\0';
|
result = strndup(plain_str, len);
|
||||||
gpgme_free(plain_str);
|
gpgme_free(plain_str);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user