diff options
Diffstat (limited to 'src/config/tlscerts.c')
-rw-r--r-- | src/config/tlscerts.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c index 008d28f6..d2f053fa 100644 --- a/src/config/tlscerts.c +++ b/src/config/tlscerts.c @@ -121,26 +121,17 @@ tlscerts_list(void) for (int i = 0; i < g_strv_length(groups); i++) { char* fingerprint = strdup(groups[i]); int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL); - char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL); - char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL); - char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL); - char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL); - char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL); - char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL); - char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL); + auto_gchar gchar* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL); + auto_gchar gchar* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL); + auto_gchar gchar* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL); + auto_gchar gchar* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL); + auto_gchar gchar* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL); + auto_gchar gchar* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL); + auto_gchar gchar* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL); TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore, notafter, keyalg, signaturealg, NULL); - free(fingerprint); - free(serialnumber); - free(subjectname); - free(issuername); - free(notbefore); - free(notafter); - free(keyalg); - free(signaturealg); - res = g_list_append(res, cert); } @@ -316,25 +307,16 @@ tlscerts_get_trusted(const char* const fingerprint) } int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL); - char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL); - char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL); - char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL); - char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL); - char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL); - char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL); - char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL); + auto_gchar gchar* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL); + auto_gchar gchar* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL); + auto_gchar gchar* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL); + auto_gchar gchar* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL); + auto_gchar gchar* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL); + auto_gchar gchar* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL); + auto_gchar gchar* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL); TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore, notafter, keyalg, signaturealg, NULL); - - free(serialnumber); - free(subjectname); - free(issuername); - free(notbefore); - free(notafter); - free(keyalg); - free(signaturealg); - return cert; } |