summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-08-23 00:47:21 +0200
committerPablo Barciela <[email protected]>2019-08-24 00:22:27 +0200
commit11f8e4601ffcb9c1c66d599d8cda66bae8f1ced5 (patch)
tree677a679c9b32b8afdc21282fa4b9cf8e2b1d80d2
parent988d5b7499756bf3fbe3319c3e7197c74c5869d1 (diff)
downloadpluma-11f8e4601ffcb9c1c66d599d8cda66bae8f1ced5.tar.bz2
pluma-11f8e4601ffcb9c1c66d599d8cda66bae8f1ced5.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")); ^~~~~~~
-rw-r--r--tests/smart-converter.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/smart-converter.c b/tests/smart-converter.c
index 722edddc..bb8c9819 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,