about summary refs log tree commit diff stats
path: root/src/pgp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pgp')
-rw-r--r--src/pgp/gpg.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index 8762660d..3ef69c1d 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -721,10 +721,9 @@ p_gpg_decrypt(const char* const cipher)
     char* plain_str = gpgme_data_release_and_get_mem(plain_data, &len);
     char* result = NULL;
     if (plain_str) {
-        plain_str[len] = 0;
-        result = g_strdup(plain_str);
+        result = strndup(plain_str, len);
+        gpgme_free(plain_str);
     }
-    gpgme_free(plain_str);
 
     if (passphrase_attempt) {
         passphrase = strdup(passphrase_attempt);