[librest/wip/teuf/gtask: 27/28] tests/oauth2: Fix 'token' leaks
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/wip/teuf/gtask: 27/28] tests/oauth2: Fix 'token' leaks
- Date: Mon, 20 Jun 2016 10:43:26 +0000 (UTC)
commit 6b18e2fb6a9b5a76cec62f2f6b6d9d1ae6ab9d42
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Jun 20 12:11:26 2016 +0200
tests/oauth2: Fix 'token' leaks
The string returned from oauth2_proxy_extract_access_token() must be
freed. This fixes:
==16342== 27 bytes in 1 blocks are definitely lost in loss record 125 of 278
==16342== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==16342== by 0x5F5CE58: g_malloc (gmem.c:94)
==16342== by 0x5F75917: g_strndup (gstrfuncs.c:425)
==16342== by 0x56D9BA4: soup_uri_decoded_copy (soup-uri.c:761)
==16342== by 0x4E48C0B: oauth2_proxy_extract_access_token (oauth2-proxy.c:392)
==16342== by 0x400A25: test_access_token_simple (oauth2.c:44)
==16342== by 0x5F7C983: test_case_run (gtestutils.c:2158)
==16342== by 0x5F7C983: g_test_run_suite_internal (gtestutils.c:2241)
==16342== by 0x5F7CB4E: g_test_run_suite_internal (gtestutils.c:2253)
==16342== by 0x5F7CD5D: g_test_run_suite (gtestutils.c:2328)
==16342== by 0x5F7CD80: g_test_run (gtestutils.c:1596)
==16342== by 0x400B64: main (oauth2.c:65)
==16342==
==16342== 27 bytes in 1 blocks are definitely lost in loss record 126 of 278
==16342== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==16342== by 0x5F5CE58: g_malloc (gmem.c:94)
==16342== by 0x5F75917: g_strndup (gstrfuncs.c:425)
==16342== by 0x56D9BA4: soup_uri_decoded_copy (soup-uri.c:761)
==16342== by 0x4E48C0B: oauth2_proxy_extract_access_token (oauth2-proxy.c:392)
==16342== by 0x400A97: test_url_encoding_access_token (oauth2.c:51)
==16342== by 0x5F7C983: test_case_run (gtestutils.c:2158)
==16342== by 0x5F7C983: g_test_run_suite_internal (gtestutils.c:2241)
==16342== by 0x5F7CB4E: g_test_run_suite_internal (gtestutils.c:2253)
==16342== by 0x5F7CD5D: g_test_run_suite (gtestutils.c:2328)
==16342== by 0x5F7CD80: g_test_run (gtestutils.c:1596)
==16342== by 0x400B64: main (oauth2.c:65)
tests/oauth2.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/tests/oauth2.c b/tests/oauth2.c
index 23e609f..12721bc 100644
--- a/tests/oauth2.c
+++ b/tests/oauth2.c
@@ -36,6 +36,7 @@ test_url_fragment_no_access_token ()
char *token = oauth2_proxy_extract_access_token ("http://example.com/foo?foo=1#bar");
g_assert_null (token);
+ g_free (token);
}
static void
@@ -44,6 +45,7 @@ test_access_token_simple ()
char *token = oauth2_proxy_extract_access_token
("http://example.com/foo?foo=1#access_token=1234567890_12.34561abcdefg&bar");
g_assert_cmpstr (token, ==, "1234567890_12.34561abcdefg");
+ g_free (token);
}
static void test_url_encoding_access_token ()
@@ -51,6 +53,7 @@ static void test_url_encoding_access_token ()
char *token = oauth2_proxy_extract_access_token
("http://example.com/foo?foo=1#access_token=1234567890%5F12%2E34561abcdefg&bar");
g_assert_cmpstr (token, ==, "1234567890_12.34561abcdefg");
+ g_free (token);
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]