diff options
author | Pablo Barciela <[email protected]> | 2019-08-23 00:47:21 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-08-23 15:02:43 +0200 |
commit | 18603e5135ad95af87ce855a328d3a01f7a4dd5c (patch) | |
tree | 715dcb7fb18c8694a366b6e65dddc04ef2dfb17c /tests/smart-converter.c | |
parent | 82734ac6b45ceeef7a67ae46f8419a5967fd0507 (diff) | |
download | pluma-18603e5135ad95af87ce855a328d3a01f7a4dd5c.tar.bz2 pluma-18603e5135ad95af87ce855a328d3a01f7a4dd5c.tar.xz |
smart-converter: Fix memory leaks
Fixes clang analyzer warnings:
smart-converter.c:108:8: warning: Potential leak of memory pointed to by 'out'
if (!care_about_error)
^~~~~~~~~~~~~~~~
smart-converter.c:337:7: warning: Potential leak of memory pointed to by 'aux'
aux2 = do_test (aux, NULL, encs, aux_len, &guessed);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
smart-converter.c:339:12: warning: Potential leak of memory pointed to by 'aux2'
g_assert (guessed == pluma_encoding_get_from_charset ("UTF-16"));
^~~~~~~
Diffstat (limited to 'tests/smart-converter.c')
-rw-r--r-- | tests/smart-converter.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/smart-converter.c b/tests/smart-converter.c index 44466f0e..f2aecfde 100644 --- a/tests/smart-converter.c +++ b/tests/smart-converter.c @@ -98,6 +98,7 @@ get_encoded_text (const gchar *text, else if (err) { g_printf ("** You don't care, but there was an error: %s", err->message); + g_free (out); return NULL; } @@ -107,6 +108,7 @@ get_encoded_text (const gchar *text, { if (!care_about_error) { + g_free (out); return NULL; } else @@ -337,6 +339,9 @@ test_guessed () aux2 = do_test (aux, NULL, encs, aux_len, &guessed); g_assert (guessed == pluma_encoding_get_from_charset ("UTF-16")); + + g_free (aux); + g_free (aux2); } int main (int argc, |