libnm-util: free temporary string when parsing OpenSSL key files

'str' was not freed anywhere.

==23089== 2,072 (24 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 5,063 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B906C7FA: g_string_sized_new (gstring.c:121)
==23089==    by 0x39B906CE75: g_string_new_len (gstring.c:186)
==23089==    by 0x31FC0149CE: parse_old_openssl_key_file (crypto.c:150)
==23089==    by 0x31FC014E33: crypto_decrypt_private_key_data (crypto.c:494)
==23089==    by 0x31FC01592E: crypto_verify_private_key_data (crypto.c:703)
==23089==    by 0x31FC015AEB: crypto_verify_private_key (crypto.c:732)
==23089==    by 0x31FC0200E5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1640)
==23089==    by 0xC694304: eap_tls_reader (reader.c:2280)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
This commit is contained in:
Dan Williams 2013-03-07 18:01:01 -06:00
parent 2878481c09
commit ca00badb03

View file

@ -231,6 +231,7 @@ parse_old_openssl_key_file (const GByteArray *contents,
_("Could not decode private key."));
goto parse_error;
}
g_string_free (str, TRUE);
if (lines)
g_strfreev (lines);
@ -244,6 +245,8 @@ parse_old_openssl_key_file (const GByteArray *contents,
parse_error:
g_free (cipher);
g_free (iv);
if (str)
g_string_free (str, TRUE);
if (lines)
g_strfreev (lines);
return NULL;