Blame SOURCES/0061-test_responder-Check-memory-leak-in-sized_output_nam.patch

9f2ebf
From d624420972d061f72b08727bd7b2e227ce047272 Mon Sep 17 00:00:00 2001
9f2ebf
From: Lukas Slebodnik <lslebodn@redhat.com>
9f2ebf
Date: Tue, 28 Nov 2017 12:20:26 +0100
9f2ebf
Subject: [PATCH 61/67] test_responder: Check memory leak in sized_output_name
9f2ebf
MIME-Version: 1.0
9f2ebf
Content-Type: text/plain; charset=UTF-8
9f2ebf
Content-Transfer-Encoding: 8bit
9f2ebf
9f2ebf
Resolves:
9f2ebf
https://pagure.io/SSSD/sssd/issue/3588
9f2ebf
9f2ebf
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
9f2ebf
(cherry picked from commit 051e0fc7cc86fb4e4b3a9323a61684ad3a6fa589)
9f2ebf
---
9f2ebf
 src/tests/cmocka/test_responder_common.c | 20 ++++++++++++++++++++
9f2ebf
 1 file changed, 20 insertions(+)
9f2ebf
9f2ebf
diff --git a/src/tests/cmocka/test_responder_common.c b/src/tests/cmocka/test_responder_common.c
9f2ebf
index fb7e4ee500570319999e6e85ee14a05cddea8de3..5441167caeb284982ee76926117da029966ec997 100644
9f2ebf
--- a/src/tests/cmocka/test_responder_common.c
9f2ebf
+++ b/src/tests/cmocka/test_responder_common.c
9f2ebf
@@ -316,6 +316,23 @@ void test_schedule_get_domains_task(void **state)
9f2ebf
     talloc_free(dummy_ncache_ptr);
9f2ebf
 }
9f2ebf
 
9f2ebf
+void test_sss_output_fqname(void **state)
9f2ebf
+{
9f2ebf
+    struct parse_inp_test_ctx *parse_inp_ctx = talloc_get_type(*state,
9f2ebf
+                                                   struct parse_inp_test_ctx);
9f2ebf
+    errno_t ret;
9f2ebf
+    struct sized_string *res = NULL;
9f2ebf
+
9f2ebf
+    ret = sized_output_name(parse_inp_ctx, parse_inp_ctx->rctx, "dummy",
9f2ebf
+                            parse_inp_ctx->tctx->dom, &res;;
9f2ebf
+    assert_int_equal(ret, EOK);
9f2ebf
+    assert_non_null(res);
9f2ebf
+    assert_string_equal("dummy", res->str);
9f2ebf
+    assert_int_equal(6, res->len);
9f2ebf
+
9f2ebf
+    talloc_zfree(res);
9f2ebf
+}
9f2ebf
+
9f2ebf
 int main(int argc, const char *argv[])
9f2ebf
 {
9f2ebf
     int rv;
9f2ebf
@@ -346,6 +363,9 @@ int main(int argc, const char *argv[])
9f2ebf
         cmocka_unit_test_setup_teardown(test_schedule_get_domains_task,
9f2ebf
                                         parse_inp_test_setup,
9f2ebf
                                         parse_inp_test_teardown),
9f2ebf
+        cmocka_unit_test_setup_teardown(test_sss_output_fqname,
9f2ebf
+                                        parse_inp_test_setup,
9f2ebf
+                                        parse_inp_test_teardown),
9f2ebf
     };
9f2ebf
 
9f2ebf
     /* Set debug level to invalid value so we can deside if -d 0 was used. */
9f2ebf
-- 
9f2ebf
2.14.3
9f2ebf