Fix string leaks
authorColin Leroy <colin@colino.net>
Mon, 10 Aug 2015 18:58:32 +0000 (20:58 +0200)
committerColin Leroy <colin@colino.net>
Mon, 10 Aug 2015 18:58:32 +0000 (20:58 +0200)
src/plugins/pgpmime/pgpmime.c
src/plugins/smime/smime.c

index afcf94e..05cef5c 100644 (file)
@@ -544,8 +544,10 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *fr
        if (result && result->signatures) {
                gpgme_new_signature_t sig = result->signatures;
                if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
-                       micalg = g_strdup_printf("pgp-%s", g_ascii_strdown(gpgme_hash_algo_name(
-                               result->signatures->hash_algo),-1));
+                       gchar *down_algo = g_ascii_strdown(gpgme_hash_algo_name(
+                               result->signatures->hash_algo), -1);
+                       micalg = g_strdup_printf("pgp-%s", down_algo);
+                       g_free(down_algo);
                } else {
                        micalg = g_strdup(gpgme_hash_algo_name(
                                result->signatures->hash_algo));
index e3970b6..5f7068b 100644 (file)
@@ -642,8 +642,10 @@ gboolean smime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *from
        result = gpgme_op_sign_result(ctx);
        if (result && result->signatures) {
            if (gpgme_get_protocol(ctx) == GPGME_PROTOCOL_OpenPGP) {
-               micalg = g_strdup_printf("pgp-%s", g_ascii_strdown(gpgme_hash_algo_name(
-                           result->signatures->hash_algo),-1));
+               gchar *down_algo = g_ascii_strdown(gpgme_hash_algo_name(
+                           result->signatures->hash_algo), -1);
+               micalg = g_strdup_printf("pgp-%s", down_algo);
+               g_free(down_algo);
            } else {
                micalg = g_strdup(gpgme_hash_algo_name(
                            result->signatures->hash_algo));